| Author |
Topic Search Topic Options
|
zMaestro
Senior Member
Joined: 11 May 2003
Location: Egypt
Status: Offline
Points: 1183
|
Post Options
Thanks(0)
Quote Reply
Posted: 18 November 2003 at 2:30am |
I didn't find any difference between the pure ASP upload I was using and the aspupload component. I still can't use Request.Form in my asp page.
I want to update a database using pure asp, and in the same time upload the file to the server, the main problem is I can't use Request.Form (I use to send the data to the database) and ENCTYPE="multipart/form-data" I use to upload the files with in the form.
The aspupload manual says:
Due to the "multipart/form-data" attribute of upload forms, your ASP script can no longer use the built-in Request.Form collection to access individual form items. AspUpload solves this problem by offering two collections of its own, Upload.Files and Upload.Form to provide access to uploaded files and text fields, respectively. |
This problem can be solved either by:
- being able to set a default value for the <Input File> so to read it from another page that doesn't use Request.Form in the script, so I be able to upload.
- being able to use ENCTYPE="multipart/form-data" with the Request.Form.
|
 |
zMaestro
Senior Member
Joined: 11 May 2003
Location: Egypt
Status: Offline
Points: 1183
|
Post Options
Thanks(0)
Quote Reply
Posted: 18 November 2003 at 2:32am |
|
OR simply, what is the simplest way you use to upload files into your server and in the same time writing to database.
|
 |
Scotty32
Moderator Group
Joined: 30 November 2002
Location: Manchester, UK
Status: Offline
Points: 1682
|
Post Options
Thanks(0)
Quote Reply
Posted: 18 November 2003 at 3:32am |
ok, i dont think you see the point here
what you do to upload, and add to your database is use that "encrypt" line thing in the <form> tag
then create on your "processing" page, the object for ASPUpload
then you can use upload.form which IS Request.Form ... you cant use Request.Form... it is replaced with upload.Form
(sorry if this "sounds" offenive" but..) do you get it now?
you create the object for ASPUpload, at the top of the page then you can use the Upload.Form("fieldname") to add to your database, i had loads of problems with this, untill i worked it out
here ya go, an example:
upload = createobject("aspupload")
*upload code*
*connect to table* rs.addnew rs("field") = upload.Form("field") rs.update rs.close
set upload = nothing
does that explain it better?
(PS i advice AGAIST copy & pasting my code above, as its wrong as i dont know the EXACT commands, but oviously you'll know them.. or can find them out, i just did it quick)
|
 |
zMaestro
Senior Member
Joined: 11 May 2003
Location: Egypt
Status: Offline
Points: 1183
|
Post Options
Thanks(0)
Quote Reply
Posted: 18 November 2003 at 4:58am |
I read what you refered too, and I understand it, my problem is my page is complicated, it is not a simple code, uploading a picture is only a case from many cases. PLUS I use Request.Form passing Username and UserID and many other things through pages. (It is a control panel). there are also included pages containing Request.Form, I can't change all of them to Upload.Form 
Changing Request.Form to Upload.Form is not a solution for me...
The best solution is how can I set a default value for:
<input type="file" name="attach1">
like
<input type="file" name="attach1" Value="<%= Request.QueryString("ImageFile") %>">
or even like:
<input type="file" name="attach1" onfocus="value='the value here'">
is there a solution 
|
 |
MorningZ
Senior Member
Joined: 06 May 2002
Location: United States
Status: Offline
Points: 1793
|
Post Options
Thanks(0)
Quote Reply
Posted: 18 November 2003 at 5:59am |
zMaestro wrote:
This problem can be solved either by:
- being able to set a default value for the <Input File> so to read it from another page that doesn't use Request.Form in the script, so I be able to upload.
- being able to use ENCTYPE="multipart/form-data" with the Request.Form.
| but you aren't reading what anyone is saying! neither of of those is possible!!
OK, imagine that prefilling a file input was fillable.... one could code a page to "pre-fill" that with "C:\WINDOWS\security\res1.log" and then say in javascript "form1.submit()".. bam, someone just took a file from your windows directory to their server... now while i have no idea what that file i used an example for does or is, i am sure there's files in the windows directory that you don't want someone else getting a hold of
Let's look at the second "option": when you use the "multipart" encoding type, you are drasticlaly changing the form, it is no longer usable with the "Request.Form" which is a method to goto the page header and extract text information.. when you encode the form to multipart, the post is now binary in nature
I can tell you haven't even taken the 5 mins to look at the ASPUpload documentation, because you'd see clear as day that the component has "Request.Form"-like ability to easily extract the "other" fields from the binary post
|
|
Contribute to the working anarchy we fondly call the Internet
|
 |
zMaestro
Senior Member
Joined: 11 May 2003
Location: Egypt
Status: Offline
Points: 1183
|
Post Options
Thanks(0)
Quote Reply
Posted: 18 November 2003 at 1:06pm |

I can tell you haven't even taken the 5 mins |
I took one hour studing the aspupload, still the same problem as i said. Upload.Form is not a solution for me, even if it is typically like Request.Form, that's why I neglected it from the very begining and tried searching fo another solution.
The page is inside a control panel, the user navigates through forms passing variables from one page to another. so, I can't use Upload.Form instead Request.Form, since the navigations forms are the same in the whole system, and the code updating the database are also the same in the whole system, i can't modify them now.
anyway...
thanks Scotty_32 thanks MorningZ
Edited by zMaestro
|
 |
Scotty32
Moderator Group
Joined: 30 November 2002
Location: Manchester, UK
Status: Offline
Points: 1682
|
Post Options
Thanks(0)
Quote Reply
Posted: 19 November 2003 at 2:00pm |
well if you have loads of includes
why not have a
strMode = "upload"
if strMode = "upload" then upload.form("field") else Request.Form("field") end if
but back to the original topic (filling in a "file" input) ever thought about uploading the file the first time the user selects it? and adding it to the database? for if you need it for anyfiin else, since you dont need to upload it twice.... but if you need to have 2 copys in difference folders, why not "copy" the file using the database to find out the path/file name and copy it to where you need??? this would solve your problem
also ... ever thought about Cookies and a Common file to pass variables?
|
 |
Flamewave
Senior Member
Joined: 19 June 2002
Location: United States
Status: Offline
Points: 376
|
Post Options
Thanks(0)
Quote Reply
Posted: 20 November 2003 at 1:40pm |
|
Another solution: have a "upload file" button that opens a popup window, and have the popup window do all the work for you...nothing else to interfere with it then.
|
|
- Flamewave
They say the grass is greener on the other side, but if you really think about it, the grass is greener on both sides.
|
 |