G
google.com
Hi there!
I've been digging around looking for a sample on how to upload a file
without user action. I found the following article covering the area:
http://www.motobit.com/tips/detpg_uploadvbaie/
It describes the vba code required to handle a very simple upload
form:
<Form Action=http://127.0.0.30/util/up/free/upload.asp
Method=Post ENCTYPE="multipart/form-data">
<Input Type=File Name=FileField>
<Input Type=Submit>
</Form>
And then the VBA comes here:
'Upload file using input type=file
Sub UploadFile(DestURL As String, FileName As String, _
Optional ByVal FieldName As String = "File")
Dim sFormData As String, d As String
'Boundary of fields.
'Be sure this string is Not In the source file
Const Boundary As String =
"---------------------------0123456789012"
'Get source file As a string.
sFormData = GetFile(FileName)
'Build source form with file contents
d = "--" + Boundary + vbCrLf
d = d + "Content-Disposition: form-data; name=""" + FieldName +
""";"
d = d + " filename=""" + FileName + """" + vbCrLf
d = d + "Content-Type: application/upload" + vbCrLf + vbCrLf
d = d + sFormData
d = d + vbCrLf + "--" + Boundary + "--" + vbCrLf
'Post the data To the destination URL
IEPostStringRequest DestURL, d, Boundary
End Sub
My problem is that my form looks like this:
<form action="upload.asp?
action=upload&type=product&item=pic1&element=&id=3170&w=1000&h=1000&maxw=200&maxh=5000"
method="post" name="upload" enctype="multipart/form-data">
<input type="hidden" name="type" value="product">
<input type="hidden" name="item" value="pic1">
<input type="hidden" name="element" value="">
<input type="hidden" name="id" value="3170">
<input type="hidden" name="w" value="1000">
<input type="hidden" name="h" value="1000">
<input type="file" name="picture" size="28">
<input type="submit" value=" upload "">
</form>
So how do I modify the above UploadFile sub, so that it includes all
the fields in the form?
Any help appreciated, because I have to upload 1000+ files 8-()
So any suggestions??
/hco
I've been digging around looking for a sample on how to upload a file
without user action. I found the following article covering the area:
http://www.motobit.com/tips/detpg_uploadvbaie/
It describes the vba code required to handle a very simple upload
form:
<Form Action=http://127.0.0.30/util/up/free/upload.asp
Method=Post ENCTYPE="multipart/form-data">
<Input Type=File Name=FileField>
<Input Type=Submit>
</Form>
And then the VBA comes here:
'Upload file using input type=file
Sub UploadFile(DestURL As String, FileName As String, _
Optional ByVal FieldName As String = "File")
Dim sFormData As String, d As String
'Boundary of fields.
'Be sure this string is Not In the source file
Const Boundary As String =
"---------------------------0123456789012"
'Get source file As a string.
sFormData = GetFile(FileName)
'Build source form with file contents
d = "--" + Boundary + vbCrLf
d = d + "Content-Disposition: form-data; name=""" + FieldName +
""";"
d = d + " filename=""" + FileName + """" + vbCrLf
d = d + "Content-Type: application/upload" + vbCrLf + vbCrLf
d = d + sFormData
d = d + vbCrLf + "--" + Boundary + "--" + vbCrLf
'Post the data To the destination URL
IEPostStringRequest DestURL, d, Boundary
End Sub
My problem is that my form looks like this:
<form action="upload.asp?
action=upload&type=product&item=pic1&element=&id=3170&w=1000&h=1000&maxw=200&maxh=5000"
method="post" name="upload" enctype="multipart/form-data">
<input type="hidden" name="type" value="product">
<input type="hidden" name="item" value="pic1">
<input type="hidden" name="element" value="">
<input type="hidden" name="id" value="3170">
<input type="hidden" name="w" value="1000">
<input type="hidden" name="h" value="1000">
<input type="file" name="picture" size="28">
<input type="submit" value=" upload "">
</form>
So how do I modify the above UploadFile sub, so that it includes all
the fields in the form?
Any help appreciated, because I have to upload 1000+ files 8-()
So any suggestions??
/hco