Monthly Archives: February 2012

Programmatically upload form with text field and file field to server using PHP stream_context_create

OK, this turned out to be a tricky one. For some reason I wanted to programmatically post data to a server. I wanted to do the equivalent to posting this form from a web-browser: <!DOCTYPE html PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN” “http://www.w3.org/TR/html4/loose.dtd”> <html> <head> <meta http-equiv=”Content-Type” content=”text/html; charset=UTF-8″> <title>Upload</title> </head> <body> <form action=”http://localhost/upload” method=”post” enctype=”multipart/form-data”> [...]

Easy AdSense by Unreal