|
|||||||
| ASP Discussion and technical support for using and deploying Active Server Pages. |
![]() |
|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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 |
|
#2
|
||||
|
||||
|
#3
|
|||
|
|||
|
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 |
|
#4
|
||||
|
||||
|
post your code
|
|
#5
|
|||
|
|||
|
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 |
|
#6
|
||||
|
||||
|
Response.Expires is not enough. Google "asp browser caching"
|
|
#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 |
|
#8
|
||||
|
||||
|
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 |
|
#9
|
|||
|
|||
|
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 |
|
#10
|
||||
|
||||
|
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
|
|
#11
|
|||
|
|||
|
I tried, but sorry, the same result as before.
Rolf |
|
#12
|
|||
|
|||
|
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 |
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|