The fact that I am getting feature requests means people are actually using my post test server. This makes me happy :) The most recent thing people asked for was multipart/form-data uploads. As an example for this behavior see my test form (which was submitted by a user who was super helpful).
Update:This poor post has been imported from blog to blog over the years and as a result this code snippet has been horribly maimed and will not be formatted. C’est la vie.
<html> <body> <form action="http://posttestserver.com/post.php?dir=example" method="post" enctype="multipart/form-data"> File: <input type="file" name="submitted"> <input type="hidden" name="someParam" value="someValue"/> <input type="submit" value="send"> </form> </body> </html>
The resulting output should contain information about the file and a link to the actual uploaded file. Remember, this data is public and you should NOT upload private data.
cool thanks
LikeLike
A big thank you!
LikeLike
Thank you so much. This helped me really alot!
The implementation also is very developer friendly;
LikeLike
Hi,
I found a site http://www.hurl.it/#top which allow me to push XML formatted data to your site to test if all working.
The format I sent from this site as follows (within body)
referance_number
station id
station name
2012
01
01
01
02
03
2012
10
30
10
34
54
2
8
RED_PHASE
Red Phase Status
–
1
9
YEL_PHASE
Yellow Phase Status
–
1
Complete
Your testing site captured it correctly.
So, I have answered my question, we should use
Sharing here so that might help others.
Mu.Pathma
LikeLike
Awesome. Your site is just what I needed to validate a semi-complex SSL proxying proof-of-concept. Thanks so very much!
LikeLike
First, thanks for this helpful httpserver!
I’m facing an issue but I don’t know if it’s from my client or not.
I’m using a java application.
If I try to upload an file with ContentType = “application/octet-stream”, it’s working perfectly and the response shows me
== Multipart File upload. ==
Received 1 file(s)
0: posted name=file
name: file-1.wav
type: application/octet-stream
…But not when I try to set the ContentType = “audio/wav”
== Multipart File upload. ==
Received 0 file(s)
I hope someone could help me to figure out why it’s happening.
Regards,
Marcelo.
LikeLike
Marcelo,
I’m glad this was helpful.
I don’t think you can set the content type to audio/wav on an upload. The receiving server doesn’t care about the contents of the file, it just cares about what format the data being sent to it is stored in. This is why octet-stream works.
What is the use case you are trying to solve for?
— Henry
LikeLike
Hi Henry, thanks for your reply!
That is a server-side request (or at least the documentation say that)
I guess I will try to test the real server and see what happen.
But at least, thanks to your server, I need to “play” only with a single field.
Regards,
Marcelo.
LikeLike
Thank you.
LikeLike
Thank you! Very useful service.
LikeLike
Hey Henry,
Your server is immensely helpful. I wanted to test background upload in android and your server saved a lot of time.
Just wanted you know that Data Im uploading is useless so you can delete it anytime. Hoping this is not costing you much.
LikeLike
how to change the directory? Looks like “dir=someDirName” parameter is not working
LikeLike
Can you post the query string you are using? My suspicion is that you are missing the ? or an & character.
LikeLike
Hi Henry, a big thank you for the server and guides. Most helpful when i needed. I have a problem though and i’m not sure what’s wrong with the method i’m using. Using c# to issue a file upload with the multipart/form and i’m returned with response below but when i’m not able to find the file i uploaded or download/save it. What did i miss? Pls help. Thanks.
Time: Wed, 25 May 16 00:07:14 -0700
Source ip: 1.9.226.196
Headers (Some may be inserted by server)
REQUEST_URI = /post.php?dir=shasi&method=post&enctype=multipart/form-data&ContentType=application/octet-stream
QUERY_STRING = dir=shasi&method=post&enctype=multipart/form-data&ContentType=application/octet-stream
REQUEST_METHOD = POST
GATEWAY_INTERFACE = CGI/1.1
REMOTE_PORT = 17466
REMOTE_ADDR = 1.9.226.196
HTTP_CONNECTION = close
HTTP_EXPECT = 100-continue
CONTENT_LENGTH = 192
HTTP_HOST = posttestserver.com
CONTENT_TYPE = multipart/form-data; boundary=———————8d384ae4026adbf
UNIQUE_ID = V0VPIUBaMGUAAHO8Y@MAAAAF
REQUEST_TIME_FLOAT = 1464160034.4406
REQUEST_TIME = 1464160034
No Post Params.
Empty post body.
== Multipart File upload. ==
Received 1 file(s)
0: posted name=file
name: test.csv
type: application/octet-stream
error: 0
size: 0
Uploaded File: http://posttestserver.com/files/2016/05/25/f_00.07.141242971604
LikeLike
You are doing everything right. Dreamhost just started deleting files because they were too big (I think people are using PTS to share media). I will fix it this week.
LikeLike
Scratch that. The file is there, it’s just empty. Looking at my logs no file content was uploaded. :(
LikeLiked by 1 person
can i have the post.php script ? i want it to use for my testing purpose internally.
LikeLike
Unfortunately I already suffer a ton of attacks and it has some hosting specific info in it. Shoot me an email and I’m happy to share the relevant parts.
LikeLike
this was really useful
LikeLike
First thanks for this service. It has helped me a lot in testing my code. It would be nice, in the “== Multipart File upload. ==” section, to show a hash of the file, such as the sha256 hash. Perhaps it could be controlled via a query parameter. Thanks.
LikeLike