This topic is locked

Upload

9/10/2007 5:00:56 PM
ASPRunnerPro General questions
L
luic author

How can I upload to a folder in other network share? The current file upload setting requires a relative path within the program code. Please show me where I can modify the path.
Thanks.

Sergey Kornilov admin 9/10/2007

Chris,
here is how code snippet that saves uploaded file looks (..._edit.asp, ...add.asp)

If ctype = "upload2" Then

' write file

rs("Make")= strValue

if strValue<>"" then


WriteToFile Server.MapPath(GetUploadFolder("Make","") & strValue), GetRequestForm("file_Make")

end if

See my changes in bold:

If ctype = "upload2" Then

' write file

rs("Make")= strValue

if strValue<>"" then _

WriteToFile "\\server\share" & strValue, GetRequestForm("file_Make")

end if


Not sure if ASP allows you to write to network share however you can give it a try.

L
luic author 9/11/2007

Thank you.
Can I suggest that the application supports the MapPath for the upload file location as a parameter defined by the customer? It is risky to remove the complete folders when the application is modified or update.

Sergey Kornilov admin 9/11/2007

Chris,
why do you need to remove complete folders?

L
luic author 9/12/2007

The current application will generate a folder called output as you know. Usually, for quick deployment, we will remove or rename the old output folder with the new output folder. If the attachments or uploaded files stored in one of the subfolders of the Output folder, then we may easily forget the attachment folder from the old output folder. In that case, there will be a high risk of losing the attactments when a new output folder is deployed. Of course, we can get the backup copy.
If we make the attachment folder path not relatve to the output folder path, any change to the output folder will not affect the document folder. Further, we have users already having the shared folder in the network. They want to link the records to the documents in that folder. Now, we have to make copy of documents.

Sergey Kornilov admin 9/12/2007

So, what is wrong with my suggestion that allows to use a network share to upload files?