0

I am working on a form using old classic ASP. And this Classic ASP does not supports enctype=multipart/form-data . If I am using multipart/form-data then I am not getting any value after submitting the form. So please tell me how could i upload a image into a folder without using multipart/form-data. Any help will be appreciated. Thanks in advance

Sonu Kumar
  • 1
  • 1
  • 3
  • It's tricky in Classic ASP. Either you need to install a third party component or do it through an ADODB.Stream object, Take a look at this question - http://stackoverflow.com/questions/12190305/how-to-upload-files-with-asp-classic – John Jun 25 '15 at 11:46
  • There is no such thing "does not supports enctype=multipart/form-data" - this just means raw binary stream is sent from the browser to the server, so you must parse it properly. One example is [this code I wrote a while ago](http://stackoverflow.com/a/15874741/447356) – Shadow The GPT Wizard Jun 25 '15 at 13:00

1 Answers1

0

i know the pain

check this out http://www.codeproject.com/Articles/2359/File-Upload-using-a-VBScript-Class

if you want to acess other form elements use

Upload.Form("cmbtemp")

this might help you, if not tell me i will send you what i use for that

EDIT for code form code

<form name="frmSend" method="POST" enctype="multipart/form-data" accept-charset="utf-8" action="upload_pdf.asp"  >

and code for upload

function SaveFiles

    Dim Upload, fileName, fileSize, ks, i, fileKey
    DIM oufilename1,oufilename2,cmbtemp
    Set Upload = New FreeASPUpload
    Upload.SaveOne uploadsDirVar,0,oufilename1,oufilename2

    cmbtemp=Upload.Form("cmbtemp")
    'response.Write(cmbtemp)

    if oufilename2 <> "" and cmbtemp <> "" then 

    con.execute "update tbltemp set file_name='"&oufilename2&"' where ID='"&cmbtemp&"'"
    end if 

    ' If something fails inside the script, but the exception is handled
    If Err.Number <> 0 then Exit function

end function

this function called on post request

Dhiraj Wakchaure
  • 2,596
  • 6
  • 21
  • 37
  • thanks for your reply. But as I have already said i cant use enctype="mulitpart/form-data" beacuase after using this i am not able to get the values from form. If you have any other option rather then using enctype=mulitpart/form-data – Sonu Kumar Jun 26 '15 at 11:52
  • user Upload.Form("cmbtemp") for that – Dhiraj Wakchaure Jun 26 '15 at 14:11
  • Thanks @ddw147 Now I am able to upload file in a folder. But still not getting any other input value after using Upload.Form("fieldname"). I am very new to asp. And I dont know so much about asp. Please help me out – Sonu Kumar Jun 27 '15 at 07:08
  • did you try to get by Upload.Form("your_form_element_name") – Dhiraj Wakchaure Jun 27 '15 at 07:30
  • Yes I am trying Upload.Form("your_form_element_name") but not getting any value – Sonu Kumar Jun 27 '15 at 07:40
  • I am getting this error Microsoft VBScript runtime error '800a01a8' Object required: '' – Sonu Kumar Jun 27 '15 at 07:44
  • SHow us your actual code, not just one line; the `
    ` tag code that is rendered, and the back end asp too. If you're not using `multipart/form-data` then you'll run into size problems (but technically you can build your own form data)
    – frumbert Jul 01 '15 at 05:11