This topic is locked

Dynamic upload folder

9/21/2009 11:07:48 AM
ASPRunnerPro General questions
P
PCB author

I have a project that requires a new upload folder be created for each new record.
The database table tblMain contains a field named REC_NO which is a key field for the table.

REC_NO contains the inputted value for the folder name to be created.
It would also be ok if files could not be added (uploaded) until the record has been created,

so if files can be added during a record "update" or edit that would be fine.
I have found some similar examples at: http://www.xlinesoft.com/asprunnerpro/docs/upload_files_to_usersfolders.htm
but just can not get it to work. Any advice would be greatly appreciated.

I am using the current evaluation version and will purchase the enterprise version upon finding a way to address this request.
Thank you.

J
Jane 9/22/2009

Phillip,
could you clarify what doesn't work in the sample code?

You can publish your project on Demo Account and open a ticket at http://support.xlinesoft.com sending a URL to your pages along with instructions on reproducing this error. I'll try to help you.

P
PCB author 9/23/2009



Phillip,
could you clarify what doesn't work in the sample code?

You can publish your project on Demo Account and open a ticket at http://support.xlinesoft.com sending a URL to your pages along with instructions on reproducing this error. I'll try to help you.


If you could give me an example of Values in the code below that would be helpful...
I have a field named REC_NO that holds the value for the folder to be created.

The file upload folder specified in the visual editor is pic_temp

I guess I'm a bit confused what field to enter where XX_XX is and what the value is being assigned to.

I'm not using a MapPath to the DB if that's an issue too.
Thanks - Phillip
Dim fso, f, ndir

ndir=server.MapPath(".") & "\" & GetUploadFolder(pictemp,"") & session("UserID")
Set fso = CreateObject("Scripting.FileSystemObject")

If not fso.FolderExists(ndir) Then


set f=fso.CreateFolder(ndir)

values(XX_XX) = session("UserID") & "\" & values(REC_NO)

J
Jane 9/24/2009

Hi,
you just need to replace FieldName with your actual field name where file names will be stored:

Dim fso, f, ndir
ndir=server.MapPath(".") & "\" & GetUploadFolder("FieldName","") & values("REC_NO")
Set fso = CreateObject("Scripting.FileSystemObject")
If not fso.FolderExists(ndir) Then _
set f=fso.CreateFolder(ndir)
values(FieldName) = values("REC_NO") & "\" & values("FieldName")