 |
|
 |
I want use ASPX file to get the upload file,any sample in C# aspx ?
thx
AE
|
|
|
|
 |
|
 |
It is not ok for video file upload.
|
|
|
|
 |
|
 |
HCG Ultra Diet Drops is the hottest weight loss program in the online market. Its premium natural, homeopathic formula promotes in the weight reduction amazingly. It is highly recommended by numerous doctors worldwide due to its safe-to-use form.
|
|
|
|
 |
|
 |
Hi, first thanks for this code, this is exactly what I need.
But there seems to be a problem, becaus as respone I only get the code of the upload-form and the file has not beeen uploaded to the server.
I have a html-form with a file upload, the file is the only parameter.
uploadfile = @"C:\_User\CHRS\fehlerworkflow.jpg";
string outdata = UploadFileEx(uploadfile,
"http://siedlerchr.bplaced.net/xxxFormular.html", "uploaded", "image/pjpeg",
querystring, cookies);
So when I run the code, everything seems to be fine, but as Response I only get the code of the html upload-form and the file has not been uploaded to the server!
I don't know why!
It would be great if you can help me or say me where my problem is
Here is the input line of the form:
<input name="uploaded" type="file" />
This form calls the upload.php script, where the file should be moved:
<?php
$target = "upload/";
$target = $target . basename( $_FILES['uploaded']['name']) ;
if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target))
{
echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded";
}
else {
echo "Sorry, there was a problem uploading your file.";
}
?>
|
|
|
|
 |
|
 |
Hi all!
When I try to divide the file in small chunks and doing something simple as:
while (byteCounter < fileData.Length)
{
if (byteCounter + chunkSize <= fileData.Length)
requestStream.Write(fileData, byteCounter, chunkSize);
if (backgorundWorker.CancellationPending) {
webrequest.Abort();
requestStream.Close();
}
}
It keeps throwing exception on requestStream.Close() and keeps blocking the next upload - stream is actually not closed.
Is there any proper way to close the stream to avoid this?
Thanks!
|
|
|
|
 |
|
 |
Same problem
Any Idea?
|
|
|
|
 |
|
 |
It was very useful thanks man
|
|
|
|
 |
|
 |
you forgot to close the stream.
|
|
|
|
 |
|
 |
Hi madmik3,
Really brilliant article. It helped me a lot to learn.
It works fine with PHP pages to upload files.
But i m facing problem to upload file to server by making a HTTPWebRequest to aspx pages. Please give me your suggestions on posting files to aspx pages.
Thanks in Advance
Lead a few, Follow one....Love all, Hate none....
modified on Friday, December 5, 2008 1:04 AM
|
|
|
|
 |
|
 |
Could this be modified to do a post that requires some POST strings, the file, but then more strings afterwards? I have a website with a very funky post that request 2 string, a file, then 4 more strings. I can't figure out how to do this. I've look at dozens of great samples, like the one above, but can't find how to this what that funky website wants.
Cheers,
Glenn
|
|
|
|
 |
|
 |
Hi thanks for the article.it helps me big time.I need a bit more help in this regard.
you are using query string to send form fields..Since the form i want to simulate has too many fields so i cant send them as query string. So i have to add both form fields and upload file in the request stream.Please help me out to make body part of request stream
Many thanks
wasif
|
|
|
|
 |
|
 |
Hello,
first is an wonderful code snipped.
but i have a problem, I need to post 5 files and not only one.
Can anyone help me how does it work?
My code:
sb.Append("--");
sb.Append(boundary);
sb.Append("\r\n");
sb.Append("Content-Disposition: form-data; name=\"");
sb.Append(fileFormName);
sb.Append("\"; filename=\"");
sb.Append("\"");
sb.Append("\r\n");
sb.Append("Content-Type: ");
sb.Append(contenttype);
sb.Append("\r\n");
sb.Append("\r\n");
sb.Append("--");
sb.Append(boundary);
sb.Append("\r\n");
sb.Append("Content-Disposition: form-data; name=\"");
sb.Append(fileFormName);
sb.Append("\"; filename=\"");
sb.Append(Path.GetFileName(uploadfile));
sb.Append("\"");
sb.Append("\r\n");
sb.Append("Content-Type: ");
sb.Append(contenttype);
sb.Append("\r\n");
sb.Append("\r\n");
string postHeader = sb.ToString();
byte[] postHeaderBytes = Encoding.UTF8.GetBytes(postHeader);
Felix
|
|
|
|
 |
|
 |
de verdad esta solucion es muy util para realizar muchos procesos de envio via web se agradece al autor!! saludos kedoz
|
|
|
|
 |
|
 |
Here's small patch. Aside from that great job, thank you!
BEFORE: while ((bytesRead = fileStream.Read(buffer, 0, buffer.Length)) != 0)
requestStream.Write(buffer, 0, bytesRead);
AFTER: while ((bytesRead = fileStream.Read(buffer, 0, buffer.Length)) != 0)
requestStream.Write(buffer, 0, bytesRead);
fileStream.Close();
|
|
|
|
 |
|
 |
I want to be able to decode a multipart post with out using a PHP or .ASPX page.
Any one know of any reference material or sample projects?
|
|
|
|
 |
|
 |
Hello... I've been playing around with the code for a while trying to get it to retrieve a responses the same way as a web browser, by that I mean, waiting for responses and retrieving them in the same way a web browser would... is there any way to do this?
|
|
|
|
 |
|
 |
I have tried changing the timeout with no luck. It will just hangs there
forever.
This class may work fine for 2 hours and suddenly have this problem.
Please help...
|
|
|
|
 |
|
 |
Very good article, it helped me a lot.
Many thanks to the author.
Regards,
Bogdan
-Creator-
|
|
|
|
 |
|
 |
Hi when I try to upload a file, I always get a Webexception at 1:40 minutes at this code: "requestStream.Write(buffer, 0, bytesRead);" I changed the Buffer size and tried it with different files, but the bug is always the same Can you tell me why this bug appears and can you fix it?
|
|
|
|
 |
|
 |
Hello,
The UploadFileEx works fine for the first file I have ti upload but the Web server is waiting for another file a attachment (Thy talk about DIME).
Somebody could tell me how I could ride on it whit this solution ?
Tnahk's a lot for help
PhBV
|
|
|
|
 |
|
 |
Hi,
The C# code works fine but the sr.ReadToEnd() return this:
Parse error: syntax error, unexpected T_STRING in C:\php\upload2.php on line 10
I'm very unexperienced with PHP. Anybody an idea how I can solve this?
Thanks!
Pete
|
|
|
|
 |
|
 |
Thanks for sharing
|
|
|
|
 |
|
 |
I'm using the UploadFileEx, post version, and get an exception in Tomcat. Stream ended unexpectedly. I see that the length is ok, I send all packets, but, seems server don't get it. I use the 8080 port.
Any idea?
|
|
|
|
 |
|
 |
I meet the same problem with Tomcat.
After reading the introduction of upload file standard,
it seems to require to do the following change to this line of code.
byte[] boundaryBytes =
Encoding.ASCII.GetBytes("\r\n--" + boundary + "\r\n");
byte[] boundaryBytes =
Encoding.ASCII.GetBytes("\r\n--" + boundary + "--\r\n");
Hope that other guys with the same problem can this thread to solve the problem.
|
|
|
|
 |
|
 |
if you test application on Tomcat ,please modify it
because i got same problem and i fixed it by these.
.. Thank you for example ..
|
|
|
|
 |