Posting a File Via HTML

  • Thread starter Thread starter David Elliott
  • Start date Start date
D

David Elliott

I have a need to send a file via a POST and am looking for some information.

As an example:

A user will be displayed an ASPX page
-- The user will select a file.
-- The file will then be read.
-- A URL Post string will be created
http://www.someWebSite.com/imageProcessor.aspx?imageName=myImage1.jpg
-- The data from the file will be sent to the website for processing.

I am looking for any information on if this is possible, and how to do this (website that explains,
pseudocode, working example, etc)

Thanks,
Dave

(e-mail address removed) (Remove .nospam if responding directly)
 
It's called an upload... It's complex because you have to manage rights on
the server to allow the user of our appPool to write there...
BE CAREFULL TO AVOID TO LET THE EXECUTE RIGHT (It's a big security hole)
Someone could post an exe (like tryan or virus and execute it)

There is somme good exemple in ast dot Net startup kit...

regards...

LJ
 
In the HTML




In the Code Behind, something like

Private Sub upload_ServerClick(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles upload.ServerClick
Dim strSavePath As String = Request.PhysicalApplicationPath &
ConfigurationSettings.AppSettings("CustomerRootFolder") &
Session.Item("CustomerID") & "\"
Dim intReturn As Integer
SaveRecord()

If Not uploadedFile.PostedFile.FileName = vbNullString Then
If Not (uploadedFile.PostedFile Is Nothing) Then
Try
Dim postedFile = uploadedFile.PostedFile
Dim filename As String = Path.GetFileName(postedFile.FileName)
Dim contentType As String = postedFile.ContentType
Dim contentLength As Integer = postedFile.ContentLength
postedFile.SaveAs(strSavePath & strFileName)
 
I was mistaken, the user will provide their own HTML page through whatever
method. They will click on a link or button and the file will be sent to me for
processing. Also, the server side solution can not be a webservice.

Since I won't be generating the page via ASPX, I will not be able to use the
HtmlInputFile class.

So this is a 2 part question now.

1) How to post a file strictly through HTML?
2) How to process it on the server side?

Thanks,
Dave

(e-mail address removed) (Remove .nospam if responding directly)
 
Search for the file upload capabilites of ASP.Net You could upload
the file then process it as you need to.

Neil
 
Back
Top