Forums
This topic is locked
Insert to two tables text to 1 Upload to 2
Posted 21 Sep 2002 16:01:33
1
has voted
21 Sep 2002 16:01:33 John Gough posted:
HelloI'm trying to tweak an insert page with ASPUpload to put the text based input to one table and the file based input (file path) to another table all within the same database (Access 2002). I have completed the Macromedia Insert data from one page into two tables tutorial and get a 'End' needed error from the incPureUpload file. Any ideas??
Thanks
Replies
Replied 26 Sep 2002 15:30:26
26 Sep 2002 15:30:26 Ned Frankly replied:
Not sure about ASPUpload, but if it behaves like other upload components, you can't TOUCH the form data before doing the upload. The way I handle this is to pass the FilePath in the URL, parse it, and update the database after the upload completes. You can use the Insert Record wizard, but it's cleaner just to write the few lines of code needed and add that to page that does the upload (after the upload completes). Here's some JavaScript that will parse out a full path (on a PC) and leave you with a variable containing the File Name only (with spaces replaced by underscores):
var FullFileName = String(Request.QueryString("fn")
var FileNameArray = FullFileName.split("\\"
var FileName = FileNameArray[FileNameArray.length-1]
FileName = String(FileName)
while (FileName.indexOf(" " >= 0) {
FileName = FileName.replace(" ","_"
}
After the upload completes, use FileName to update/insert to your table. If you want to use the existing insert page you created, do a Response.Redirect() at the end of the upload (something like Response.Redirect("insert_record.asp?FileName="+FileName))
Ned Frankly
var FullFileName = String(Request.QueryString("fn")
var FileNameArray = FullFileName.split("\\"
var FileName = FileNameArray[FileNameArray.length-1]
FileName = String(FileName)
while (FileName.indexOf(" " >= 0) {
FileName = FileName.replace(" ","_"
}
After the upload completes, use FileName to update/insert to your table. If you want to use the existing insert page you created, do a Response.Redirect() at the end of the upload (something like Response.Redirect("insert_record.asp?FileName="+FileName))
Ned Frankly
Replied 26 Sep 2002 15:34:29
26 Sep 2002 15:34:29 Ned Frankly replied:
Huh - apparently a-r-s-e is verboten, so my 'p-a-r-s-e' was censored to 'p****'. Nifty. I think.
Oh, and you will have to pass everything to the secondary page (both text fields) for this to work. I usually do the file uploads as a popup from the New Item page. That way, the file upload processes independently, and I have it update a field on the 'parent' form to indicate what file was uploaded for the new item. I can provide a sample if you need it.
Ned Frankly
Oh, and you will have to pass everything to the secondary page (both text fields) for this to work. I usually do the file uploads as a popup from the New Item page. That way, the file upload processes independently, and I have it update a field on the 'parent' form to indicate what file was uploaded for the new item. I can provide a sample if you need it.
Ned Frankly
Replied 06 Oct 2002 00:36:29
06 Oct 2002 00:36:29 John Gough replied:
ug, sorry...a samplewould help a cope criple like myslef.
appreciated
John
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
Huh - apparently a-r-s-e is verboten, so my 'p-a-r-s-e' was censored to 'p****'. Nifty. I think.
Oh, and you will have to pass everything to the secondary page (both text fields) for this to work. I usually do the file uploads as a popup from the New Item page. That way, the file upload processes independently, and I have it update a field on the 'parent' form to indicate what file was uploaded for the new item. I can provide a sample if you need it.
Ned Frankly
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
appreciated
John
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
Huh - apparently a-r-s-e is verboten, so my 'p-a-r-s-e' was censored to 'p****'. Nifty. I think.
Oh, and you will have to pass everything to the secondary page (both text fields) for this to work. I usually do the file uploads as a popup from the New Item page. That way, the file upload processes independently, and I have it update a field on the 'parent' form to indicate what file was uploaded for the new item. I can provide a sample if you need it.
Ned Frankly
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>