www.webdeveloper.com
Recent Articles
  • Finding Slow Running Queries in ASE 15
  • A More Advanced Pie Chart for Analysis Services Data
  • Adobe AIR Programming Unleashed: Working with Windows
  • Performance Testing SQL Server 2008's Change Data Capture Functionality
  • The ABC's of PHP: Introduction to PHP
  • How to Migrate from BasicFiles to SecureFiles Storage
  • Why the Twitter Haters Are Wrong
  • User Personalization with PHP: Beginning the Application
  • Whats in an Oracle Schema?
  • Lighting Enhancement in Photoshop
  •  

    Go Back   WebDeveloper.com > Server-Side Development > ASP

    ASP Discussion and technical support for using and deploying Active Server Pages.

    Reply
     
    Thread Tools Search this Thread Rate Thread Display Modes
      #1  
    Old 11-17-2009, 01:21 PM
    Odlaren Odlaren is offline
    Registered User
     
    Join Date: Nov 2009
    Posts: 7
    Change name on ASPUploaded file

    I am using ASPUpload to put image files om the server. Now the user puts his file with whatever name. I want to let the asp pages give the files name of the users member names, i.e. 245.jpg... 1245.jpg and so on.

    I thought of changing the names in an asp page with help of FileSystemObject but the problem is to know which file was uploaded. Especially if more than one user is uploading simoultanesly.

    Does anyone have a tip to help med solve this problem?

    / Rolf
    Reply With Quote
      #2  
    Old 11-17-2009, 03:22 PM
    yamaharuss's Avatar
    yamaharuss yamaharuss is offline
    V8 Rider
     
    Join Date: Jan 2008
    Location: Florida
    Posts: 684
    http://support.persits.com/show.asp?code=PS02041192
    __________________
    Internet Design Concepts
    Web Development and Hosting
    InternetDesignConcepts.com
    Reply With Quote
      #3  
    Old 11-17-2009, 06:40 PM
    Odlaren Odlaren is offline
    Registered User
     
    Join Date: Nov 2009
    Posts: 7
    It seems very difficult to me. I have tried both versions in the link but cannot get it work. Even the Response.Write "NewName:" and so on doesn't give the desired output.

    I used File.Copy(Server.MapPath("bilder") & NewName to put it a folder below the asp pages. The picture file with the original name got uploaded, but not deleted. And as mentioned the copied file did not get uploaded.

    Could it possible be that I have only one file to upload and therefore did not use the For-Next loop, just the lines inbetween?

    Rolf
    Reply With Quote
      #4  
    Old 11-19-2009, 08:06 AM
    yamaharuss's Avatar
    yamaharuss yamaharuss is offline
    V8 Rider
     
    Join Date: Jan 2008
    Location: Florida
    Posts: 684
    post your code
    __________________
    Internet Design Concepts
    Web Development and Hosting
    InternetDesignConcepts.com
    Reply With Quote
      #5  
    Old 11-19-2009, 11:04 AM
    Odlaren Odlaren is offline
    Registered User
     
    Join Date: Nov 2009
    Posts: 7
    I have now got it working. The problem before was that there did exist a file with that name. And therefore the move command did not work in this case. So, when I first deleted the old file I could rename the new one with that move command.

    I thank you for your first tip. It did work under the right circumstances.

    But now I have another problem with this: After uploading and renaming the image file, my program jumps back to an earlier asp page but the new image does not show up there. Although I have written Response.Expires = -1440 on top of the code. Not even if I put the cursor in the address field of the browser and hit enter. But it works if I update the browser with F5.

    I thought the expires command should force an update and not let the cached page show up again.

    Any ideas how I should do?

    / Rolf
    Reply With Quote
      #6  
    Old 11-19-2009, 03:49 PM
    yamaharuss's Avatar
    yamaharuss yamaharuss is offline
    V8 Rider
     
    Join Date: Jan 2008
    Location: Florida
    Posts: 684
    Response.Expires is not enough. Google "asp browser caching"
    __________________
    Internet Design Concepts
    Web Development and Hosting
    InternetDesignConcepts.com
    Reply With Quote
      #7  
    Old 11-19-2009, 06:06 PM
    Odlaren Odlaren is offline
    Registered User
     
    Join Date: Nov 2009
    Posts: 7
    After going through the tips and information that I found on Google, many people say that the following lines would do the trick:

    Response.CacheControl = "no-cache"
    Response.AddHeader "Pragma", "no-cache"
    Response.Expires = -1

    .. and some more. But it did not help all those who got this information, nor did it work for me either. Some people say there that it is not possible to clear the cached images.

    So I guess that there actually is no cure to this...?

    Rolf
    Reply With Quote
      #8  
    Old 11-20-2009, 11:14 AM
    yamaharuss's Avatar
    yamaharuss yamaharuss is offline
    V8 Rider
     
    Join Date: Jan 2008
    Location: Florida
    Posts: 684
    There is always a cure. I'm not so sure yours is a cache issue.. but if it is you can always add a unique querystring tag to be sure you get a fresh page.

    yourpage.asp?somestring=someuniquevalue
    __________________
    Internet Design Concepts
    Web Development and Hosting
    InternetDesignConcepts.com
    Reply With Quote
      #9  
    Old 11-20-2009, 01:27 PM
    Odlaren Odlaren is offline
    Registered User
     
    Join Date: Nov 2009
    Posts: 7
    I do use: Response.Redirect "kunder.asp?kundid=3" and did also think that this would update the entire page. When I do this type of jumps all the new text will be updated, but it seems not to happen when an image with the same name as before is updated. Even if the image size and date is changed.

    Rolf
    Reply With Quote
      #10  
    Old 11-20-2009, 01:30 PM
    yamaharuss's Avatar
    yamaharuss yamaharuss is offline
    V8 Rider
     
    Join Date: Jan 2008
    Location: Florida
    Posts: 684
    Try:
    Code:
    Function uniqueid()
           Dim theseconds
           theseconds=DateDiff("s", "01/01/2000 12:00:00 AM", Date() & " " & Time())
           uniqueid=theseconds
    End Function
    
    Response.Redirect "kunder.asp?kundid=3&UID="&uniqueid
    __________________
    Internet Design Concepts
    Web Development and Hosting
    InternetDesignConcepts.com
    Reply With Quote
      #11  
    Old 11-20-2009, 02:42 PM
    Odlaren Odlaren is offline
    Registered User
     
    Join Date: Nov 2009
    Posts: 7
    I tried, but sorry, the same result as before.

    Rolf
    Reply With Quote
      #12  
    Old 11-22-2009, 09:08 AM
    Odlaren Odlaren is offline
    Registered User
     
    Join Date: Nov 2009
    Posts: 7
    Maybe it isn't a cache problem as you wrote. I thought so before, but now I don't know. After installing Mozilla Firefox 3.5 I tested and then it updates as it should. And I have checked the cache is enabled in FF. But IE 7 doesn't update.

    Is there an ASP command to force the page to reload from server?

    / Rolf
    Reply With Quote
    Reply

    Bookmarks


    Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
     
    Thread Tools Search this Thread
    Search this Thread:

    Advanced Search
    Display Modes Rate This Thread
    Rate This Thread:

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is Off
    HTML code is Off
    Forum Jump


    All times are GMT -5. The time now is 02:41 PM.



    Acceptable Use Policy


    The Network for Technology Professionals

    Search:

    About Internet.com

    Legal Notices, Licensing, Permissions, Privacy Policy.
    Advertise | Newsletters | E-mail Offers

    Powered by vBulletin® Version 3.7.3
    Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.