Forums

ASP

This topic is locked

Pureasp Upload Overwrite file

Posted 23 Jul 2012 13:36:50
1
has voted
23 Jul 2012 13:36:50 Charles Harford posted:
Can anyone please help?
I'm trying to set up an image uploader that will overwrite an exiting file with the same name. However it always returns with an error.

Here is my set up:

'*** Pure ASP File Upload 3.0.3
' Process form upload
Dim pau, DMX_uploadAction, UploadRequest, UploadQueryString, pau_thePath, pau_nameConflict, pau_saveWidth, pau_saveHeight
Set pau = new PureUpload
pau.ScriptLibrary = "ScriptLibrary"
pau.ConflictHandling = "over"
pau.StoreType = "file"
pau.ProgressTemplate = "win_look.htm"
pau.ProgressWidth = 400
pau.ProgressHeight = 200
pau.UploadFolder = varRUF_Folder
pau.AllowedExtensions = "GIF,JPG,JPEG,BMP,PNG" ' "images"
pau.MaxFileSize = 5072
Dim uploadfile
set uploadfile = pau.AddField("file"
uploadfile.UploadFolder = varRUF_Folder
uploadfile.AllowedExtensions = "GIF,JPG,JPEG,BMP,PNG" ' "images"
uploadfile.MaxFileSize = 5072
pau.ProcessUpload
pau.SaveAll


' *** Rename Uploaded Files 1.7.2
If (CStr(Request.QueryString("GP_upload") <> "" Then
Dim REUF_renameMask
REUF_renameMask = pau("id"
RenameUploadedFiles pau_thePath, pau_nameConflict, REUF_renameMask
end if


' *** Smart Image Processor 1.1.5
If (CStr(Request.QueryString("GP_upload") <> "" Then
Dim RUF_Component, RUF_DotNetResize, RUF_ResizeImages, RUF_AspectImages, RUF_maxWidth, RUF_maxHeight, RUF_Quality, RUF_MakeThumb, RUF_AspectThumb, RUF_sharp, RUF_Suffix, RUF_maxWidthThumb, RUF_maxHeightThumb, RUF_QualityThumb, RUF_RedirectURL
RUF_Component = "ASPJPEG"
RUF_DotNetResize = "ScriptLibrary/ResizeImage.aspx"
RUF_ResizeImages = true
RUF_AspectImages = varRUF_AspectRatio
RUF_maxWidth = varRUF_maxWidth
RUF_maxHeight = varRUF_maxHeight
RUF_Quality = varRUF_Quality
RUF_MakeThumb = varRUF_MakeThumb
RUF_AspectThumb = true
RUF_sharp = varRUF_sharp
RUF_Suffix = "_t"
RUF_maxWidthThumb = "90"
RUF_maxHeightThumb = ""
RUF_QualityThumb = "80"
RUF_RedirectURL = ""
if RUF_ResizeImages then
ResizeUploadedFiles RUF_Component, RUF_DotNetResize, pau_thePath, "", RUF_maxWidth, RUF_maxHeight, RUF_Quality, true, pau_saveWidth, pau_saveHeight, RUF_AspectImages, RUF_sharp, pau_nameConflict, ""
end if
if RUF_MakeThumb then
ResizeUploadedFiles RUF_Component, RUF_DotNetResize, pau_thePath, RUF_Suffix, RUF_maxWidthThumb, RUF_maxHeightThumb, RUF_QualityThumb, false, pau_saveWidth, pau_saveHeight, RUF_AspectThumb, RUF_sharp, pau_nameConflict, ""

end if
if RUF_RedirectURL <> "" then
Response.Redirect RUF_RedirectURL
end if
end if

Replies

Replied 23 Jul 2012 13:59:44
23 Jul 2012 13:59:44 Charles Harford replied:
This is the error:
File not found
/admin/ScriptLibrary/incPUAddOn.asp, line 173

Which is This line:
REUF_fso.MoveFile GetPhysicalPath(REUF_thePath & REUF_fileNameOnly), GetPhysicalPath(REUF_thePath & REUF_newFileName)

which is part of this:
if REUF_fso.FileExists(GetPhysicalPath(REUF_thePath & REUF_fileNameOnly)) then
if REUF_nameConflict = "over" And REUF_FileExist then
REUF_fso.DeleteFile GetPhysicalPath(REUF_thePath & REUF_newFileName)
end if
REUF_fso.MoveFile GetPhysicalPath(REUF_thePath & REUF_fileNameOnly), GetPhysicalPath(REUF_thePath & REUF_newFileName)
end if

So it seems that the system deletes the file then tries to move it, which it can't because it just deleted it.

Reply to this topic