Click to See Complete Forum and Search --> : File upload with a difference...


ldoodle
04-13-2009, 01:28 PM
Hiya,

I need to provide the ability for users to upload files, but instead of actually uploading the file, I want a link to file from wherever they uploaded it from. So if the file was:

\\fileserver1\Users\Documents\file1.doc

I want a field in the database to have \\fileserver1\Users\Documents\file1.doc in it, and the output on the page shows as an href.

The output part i'm OK with, it's just getting the path and filename of the document into the db.

Thanks

yamaharuss
04-14-2009, 06:09 PM
If the upload folder is always the same why not just save the file name only when uploading... then write your code:

<a href="/myfolder/<%=rs("thefilename")%>">click</a>

ldoodle
04-15-2009, 04:35 AM
That's just it; the upload folder is not always the same.

I want to avoid duplicate files being stored on multiple servers, hence the reason to give the user the ability to browse for a file and click upload. But instead of actually uploading the physical file, it puts a pointer to the file in the database.

Then they would have the ability to change the path if the file ever moved location.

ldoodle
04-15-2009, 04:53 AM
OK, just stumbled across input type="file" which is perfect for my needs.

However, I need to change the drive mapping to server name. I could strip the first 3 characters (Z:\) and replace with what I want, but is there a better way to do this?

Actually, when browsing for the file, they choose an already physical path (Z:\Folder\Subfolder\file.doc), so server.mappath doesn't work. As the could also 'upload' from Y:\Folder\Subfolder\fiel.doc, which is a different physcial path from Z:\, I need someway of converting into the virtual path, if that makes sense?