473,396 Members | 1,917 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

ASP FileSystemObject Upload.

I am having issues with a script to upload files from a client to a
webserver. The problem is not with the actual upload but with where it
uploads. The whole process is supposed to create a folder (it does)
then upload the file to that folder and this is where the problem comes
in. The file is written to the parent directory, not the directory
that was created for this user. Following is the code.

<%

strFTProotFolder = "c:\web\upload\share" 'file is saved here
Set DirectoryObject = Server.CreateObject("Scripting.FileSystemObject")
Set Upload = Server.CreateObject("Persits.Upload")

If Not DirectoryObject.FolderExists(strFTProotFolder & "\" &
upload.form("RequestID") Then
response.write("Error: Folder Does Not Exist!")
Else
strUploadTo = strFTProotFolder & "\" & upload.form("RequestID") 'file
is supposed to be saved here
Count = Upload.Save(strUploadTo)
Set file = Upload.Files("file1")
Response.Write(Count & " file uploaded.<br>")
Response.Write(upload.form("RequestID") & "<br>")
For Each File in Upload.Files
Response.Write(File.OriginalFileName & " (" & File.Size &"
bytes)<br>")
Next

End If

%>

I think the problem has to do with the 'RequestID' variable. It is
empty until after this line " Count = Upload.Save(strUploadTo) ". I
don't understand why it isn't populated until then. I had it print the
value of said variable every other line to see what it's value was
through the process.

Jun 8 '06 #1
1 8394
I would think you would create the folder when creating
the client record instead of during an upload routine

However you said the folder is created during the process
and I see nothing that creates a folder in the syntax;
A line like
Set ClientFolder = DirectoryObject.CreateFolder(strFTProotFolder & "\" &
Session("RequestID") )
unless there is more code somewhere.

I would not rely on a method that has to wait until it is finished
especially when you are relying on it to create other things.
when the user logs on create a session("RequestID") variable
and use that in the upload routine instead of the Upload.form value
which is not available until after the upload completes.


"Alex" <ia*******@gmail.com> wrote in message
news:11*********************@i40g2000cwc.googlegro ups.com...
I am having issues with a script to upload files from a client to a
webserver. The problem is not with the actual upload but with where it
uploads. The whole process is supposed to create a folder (it does)
then upload the file to that folder and this is where the problem comes
in. The file is written to the parent directory, not the directory
that was created for this user. Following is the code.

<%

strFTProotFolder = "c:\web\upload\share" 'file is saved here
Set DirectoryObject = Server.CreateObject("Scripting.FileSystemObject")
Set Upload = Server.CreateObject("Persits.Upload")

If Not DirectoryObject.FolderExists(strFTProotFolder & "\" &
upload.form("RequestID") Then
response.write("Error: Folder Does Not Exist!")
Else
strUploadTo = strFTProotFolder & "\" & upload.form("RequestID") 'file
is supposed to be saved here
Count = Upload.Save(strUploadTo)
Set file = Upload.Files("file1")
Response.Write(Count & " file uploaded.<br>")
Response.Write(upload.form("RequestID") & "<br>")
For Each File in Upload.Files
Response.Write(File.OriginalFileName & " (" & File.Size &"
bytes)<br>")
Next

End If

%>

I think the problem has to do with the 'RequestID' variable. It is
empty until after this line " Count = Upload.Save(strUploadTo) ". I
don't understand why it isn't populated until then. I had it print the
value of said variable every other line to see what it's value was
through the process.

Jun 8 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Paul Hamlington | last post by:
Hello, I've been programming in ASP for a little while now and quite an advanced user, but I have come across an unusual problem in which I need assistance. I have built my own image upload,...
3
by: Guoqi Zheng | last post by:
Dear Sir, I am trying to use do a upload function on my site. I got a upload class from Internet. However, sometimes, it works, sometimes, it give me the following error. Microsoft VBScript...
4
by: Philipp Lenssen | last post by:
This drives me crazy: I have a file upload script to save an image on the disk (and later on in the database)... it used to work and now it doesn't, though I didn't change anything within the file...
2
by: NeilS | last post by:
I'm developing under IIS V5.1 and testing on an ethernet with IIS hosted on WinXPPro. I am trying to implement file-upload using a polished version of the technique published in...
1
by: G | last post by:
Hello Friends How are you? I came with a problem near you. I want to upload a image to my ftp, iam getting this below error. i have a code which is working in my local system, i have an idea...
18
jhardman
by: jhardman | last post by:
Have you ever wanted to upload files through a form and thought, "I'd really like to use ASP, it surely has that capability, but the tutorial I used to learn ASP didn't mention how to do this."? ...
7
by: dragiton | last post by:
SA Upload SQL Database variable types (image upload and storage) I am having trouble with the SA Upload utility. The following code used to work correctly. However, I lost my database and had to...
2
by: fran7 | last post by:
Hi, I wonder if anyone could tell me if there is a default upload folder for image uploads in this code or if the code references another file. It works fine but I am trying to change the upload...
1
by: achotto | last post by:
hi, i try to upload a multiple image files. after that i will rename the files name. the problem is when i upload a 2 or more same files name exp-goal.jpg, it will return "files already exist". ok...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.