473,395 Members | 1,521 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,395 software developers and data experts.

ASP Issue with form that posts data to databse and uploads image file

Hello,

We have a small program that allows licensees around the world to submit requests to our home office. They complete the request on an ASP form (with an HTM page) over a https connection. One of the required fields is for upload. Starting in the last week, the page has begun to "misbehave". I was able to recreate the problem and it looks like the form is not able to pick up the "request.form" statements. I've done a little research and it appears that it might be the tag "enctype='multipart/form-data' in conflict with the attempt to use "request.form" Two main questions, 1) what should I use instead of request.form and 2) why would it start complaining all of a sudden. Also, the error doesn't occur with every request, it is sporadic. Also, should note that we are using ASPSmartUpload and 2 months ago I needed to edit the IIS settings to increase file size - but I'm sure this is adifferent issue.

Any suggestions would be extremely helpful!

Julie
Sep 6 '07 #1
5 1761
markrawlingson
346 Expert 100+
Hmmm,

I had a similar problem a few months back. We had a registration form (didn't include an upload field) that clients could fill out to register for our product. For some reason, about 50-60% of the time.. the form submissions would generate random invalid characters even though we were preventing them and cleaning them out using client side javascript and asp - all the potential clients we spoke to regarding the problem denied entering these themselves - so the information in the request.form object got altered somehow. You'd have the first name field be entered as "Joe" and returned in the request.form object as j%%%o%20%20%20.

We never did figure it out, though that is an excellent point about the enctype - I'll take a look at it again (it's still somewhere on our server) and check to see if it uses an enctype - i'll get back to you.
Sep 6 '07 #2
jhardman
3,406 Expert 2GB
Hi Julie,

1) instead of 'request.form("myTextInput")' you can just say 'request("myTextInput")'. The ".form" is just supposed to specify which part of the request object had the input, and it isn't really necessary unless you think you have a cookie, a querystring, or a serverVariable with the same name. A good way to test what info any page receives is this:
Expand|Select|Wrap|Line Numbers
  1. response.write "Form inputs:<br>" & vbNewLine
  2. for each x in request.form
  3.    response.write x & request.form(x) & "<br>" & vbNewLine
  4. next
  5.  
  6. response.write "Querystring inputs:<br>" & vbNewLine
  7. for each x in request.querystring
  8.    response.write x & request.querystring(x) & "<br>" & vbNewLine
  9. next
  10.  
  11. response.write "Cookies:<br>" & vbNewLine
  12. for each x in request.cookies
  13.    response.write x & request.cookies(x) & "<br>" & vbNewLine
  14. next
  15.  
  16. response.write "Server variables:<br>" & vbNewLine
  17. for each x in request.serverVariables
  18.    response.write x & request.serverVariables(x) & "<br>" & vbNewLine
  19. next
This will print all the info sent to the page (except that file inputs will only show the file name if printed like this)

2- I don'[t know why this would all of a sudden cause an error. You definitely need the enctype as you stated above in order to send both files and text inputs. Is the data sent to ASPSmartUpload first, and then sent on again to another ASP page on your server?

Jared
Sep 6 '07 #3
Hi Julie,

1) instead of 'request.form("myTextInput")' you can just say 'request("myTextInput")'. The ".form" is just supposed to specify which part of the request object had the input, and it isn't really necessary unless you think you have a cookie, a querystring, or a serverVariable with the same name. A good way to test what info any page receives is this:
Expand|Select|Wrap|Line Numbers
  1. response.write "Form inputs:<br>" & vbNewLine
  2. for each x in request.form
  3.    response.write x & request.form(x) & "<br>" & vbNewLine
  4. next
  5.  
  6. response.write "Querystring inputs:<br>" & vbNewLine
  7. for each x in request.querystring
  8.    response.write x & request.querystring(x) & "<br>" & vbNewLine
  9. next
  10.  
  11. response.write "Cookies:<br>" & vbNewLine
  12. for each x in request.cookies
  13.    response.write x & request.cookies(x) & "<br>" & vbNewLine
  14. next
  15.  
  16. response.write "Server variables:<br>" & vbNewLine
  17. for each x in request.serverVariables
  18.    response.write x & request.serverVariables(x) & "<br>" & vbNewLine
  19. next
This will print all the info sent to the page (except that file inputs will only show the file name if printed like this)

2- I don'[t know why this would all of a sudden cause an error. You definitely need the enctype as you stated above in order to send both files and text inputs. Is the data sent to ASPSmartUpload first, and then sent on again to another ASP page on your server?

Jared

Hi Jared,

Thanks for your reply. Without a doubt, issues that happen "intermittently" are the most frustrating to troubleshoot!

I changed Request.form to just request, but got the same results. I added your code and as expected all the .form elements are blank.

The page takes a number of the form elements and posts them to a database via a stored procedure, then the upload occurs

Thanks,

Julie
Sep 6 '07 #4
jhardman
3,406 Expert 2GB
Hi Jared,

Thanks for your reply. Without a doubt, issues that happen "intermittently" are the most frustrating to troubleshoot!

I changed Request.form to just request, but got the same results. I added your code and as expected all the .form elements are blank.

The page takes a number of the form elements and posts them to a database via a stored procedure, then the upload occurs

Thanks,

Julie
When you say blank, do you mean nothing is there like this:
Expand|Select|Wrap|Line Numbers
  1. Form Inputs:
  2. myTextInput:
  3. myfileInput:
  4. mySelect:
  5. submit:
  6. Querystring inputs:
or like this:
Expand|Select|Wrap|Line Numbers
  1. Form Inputs:
  2. Querystring inputs:
?

I think the problem is that you are going from one page to another on some conditions, perhaps depending on the size of the file (there is a limit to the size of files that can be imported through HTML forms regardless of server settings. If the file is larger, good uploaders can circumvent this restriction, and their methods are pretty complicated. It is my guess that ASPSmartUpload is sending data to multiple scripts) and somehow the form data isn't making it all the way through.

If the form data is first accessed somewhere else, then I would do this:
-The first time you access the data (right before you store it in the db), save all of the form data as session-level variables (this won't work for the file, unfortunately) like this:
Expand|Select|Wrap|Line Numbers
  1. for each x in request.form
  2.    session(x) = request.form(x)
  3. next
-then when you need it later, ask for session("whatever") instead of request("whatever"), its session name will be the same as its request name. Let me know if that works.

Jared
Sep 6 '07 #5
When you say blank, do you mean nothing is there like this:
Expand|Select|Wrap|Line Numbers
  1. Form Inputs:
  2. myTextInput:
  3. myfileInput:
  4. mySelect:
  5. submit:
  6. Querystring inputs:
or like this:
Expand|Select|Wrap|Line Numbers
  1. Form Inputs:
  2. Querystring inputs:
?

I think the problem is that you are going from one page to another on some conditions, perhaps depending on the size of the file (there is a limit to the size of files that can be imported through HTML forms regardless of server settings. If the file is larger, good uploaders can circumvent this restriction, and their methods are pretty complicated. It is my guess that ASPSmartUpload is sending data to multiple scripts) and somehow the form data isn't making it all the way through.

If the form data is first accessed somewhere else, then I would do this:
-The first time you access the data (right before you store it in the db), save all of the form data as session-level variables (this won't work for the file, unfortunately) like this:
Expand|Select|Wrap|Line Numbers
  1. for each x in request.form
  2.    session(x) = request.form(x)
  3. next
-then when you need it later, ask for session("whatever") instead of request("whatever"), its session name will be the same as its request name. Let me know if that works.

Jared
Jared,

Thanks again for your help. After a lot of research, we discovered that at some point in the past, somebody started the work to move to another upload product. For some reason the half-written code that has been there for awhile started to interefere with the page's processing. I ended up commenting out the offensive code and we are back in business.

I truly apprecuate the time you took to help me out!

Happy Monday!

Julie
Sep 10 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: sentinel | last post by:
Hi, Wonder if anyone can help with this problem: I am using an app with several pages, using a session to track vars between the pages, and using an image map to re-direct back and forwards...
2
by: Philip D Heady | last post by:
I have a webpage that uploads a photo picture file to server, but goes through some error checking before it redirects to the next page. Since I do not have PHP compiled with mime type support I...
2
by: Sean Dotson | last post by:
I have a form that passes variables to an asp file and then uploads a file. For some reason the request.form is not getting the info from the form. It's returning blanks. Any insight would be...
8
by: Du | last post by:
I'm trying to automate the upload process to yousendit.com, but the file size doesn't add up and yousendit.com keep rejecting my upload (it accepts the upload until the very end) I don't know...
4
by: Alex Sibilev | last post by:
Hello, I have a really weird problem I've been trying to solve it without any luck for the last couple of hours :( I'm writing a "conference board" application (quite similar to ASP.NET...
6
by: Emmanuel Petit | last post by:
First of all I am rather new into PHP. I use php 5 and I am putting together a web site for a local association I belong too. Most of the site is okay, except for this problem : I need to be...
3
chunk1978
by: chunk1978 | last post by:
hi there... i have a form where a user may optionally upload a maximum of 2 files along with other textual data (there are 2 file fields built in the form). i'm having trouble writing a php script...
44
by: badvoc | last post by:
Hi to all, Firstly I must state my knowledge of php is limited but I am a quick learner. I have taken on the task of finishing a friends website due to his untimely passing and have hit a problem...
3
by: jeremy.gehring | last post by:
Hey all, OK I'm not much of a PHP programmer; but needs must as they say. I have written AJAX file upload system that uses a PERL CGI script so that a PHP script can get the progress (nifty...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...

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.