PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I am testing this script here. http://www.php-mysql-tutorial.com/php-mysql-upload.php
All works fine for me. I am able to upload a file to the db. The problem comes when trying to download the file.
Here is the download test file from the original tutorial. http://www.php-mysql-tutorial.com/examples/download.php
I'm getting errors that the files are corrupt when I try and download them.
Here is the page I made to download http://docmann.com/get.php. I'm getting "The requested URL http:// was not found on this server." when trying to download that.
Is this a common issues with something? Or could it just be a mistake in syntax somewhere.
Or does anyone know of a better tutorial to use where the example actually works?
[feyd@home]>php -r "var_export(get_headers('http://docmann.com/download.php?id=1'));"
array (
0 => 'HTTP/1.1 200 OK',
1 => 'Date: Thu, 23 Mar 2006 22:37:31 GMT',
2 => 'WWW-Authenticate: Basic realm="Password Protected Area"',
3 => 'P3P: policyref="http://p3p.yahoo.com/w3c/p3p.xml", CP="CAO DSP COR CUR ADM DEV TAI PSA PSD IVAi IVDi CONi TELo OTPi OUR DELi SAMi OTRi UNRi PUBi IND PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA POL HEA PRE GOV"',
4 => 'Content-Disposition: attachment; filename=blocks.jpg',
5 => 'Content-length: 29433',
6 => 'Connection: close',
7 => 'Content-Type: image/jpeg',
)
The 'attachment' tells the browser to download the file rather than view it.
Well that's the plan, for it to download to the computer. This is being used for a printing company's website so customers can upload not so large files. Then they can download them to their system.
Actually after a couple more uploads it seems to be working. http://docmann.com/get.php It was the first file (blocks.jpg) that was getting the error. But you'll see that I uploaded that same file again and it works. Maybe something happened in that first transmission...not sure.