| | |||||
| ||||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | THREAD STARTER #1 (permalink) |
| SQLdumpster.com Join Date: Jun 2005 Location: West Sussex, UK
Posts: 573
![]() ![]() | PHP file uploading Hey, sorry to bother you guys. I'm trying to use PHP to upload music to my server. (it's currently set to image files because I have no audio files on my laptop and I need to test the script). However, I keep getting the error whenever I submit the form. It stores the data in the database but doesnt store the file on the server. And since adding the enctype to the form, all the $_POST variables are empty. $NP and reputation for anyone who can solve this problem or suggest a script which will enable me to upload a music file with another field for the title of the file. PHP Code: Thanks in advance.
__________________ Encenta - Amazon Associates CMS |
| |
| | #2 (permalink) |
| NamePros Expert Join Date: Nov 2003 Location: Scotland
Posts: 5,069
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | what version of php are you using? what error message do you get? what is the chmod value of the folder in which you are moving the files too? Have you ensured the tmp folder has the correct permissions ans is setup correctly in php? |
| |
| | THREAD STARTER #3 (permalink) | ||||
| SQLdumpster.com Join Date: Jun 2005 Location: West Sussex, UK
Posts: 573
![]() ![]() |
Error is the one in the PHP script - "There was an error uploading the file, please try again or contact the administrator." ????: NamePros.com http://www.namepros.com/showthread.php?t=148878 CHMOD - 0777 how do I check the temp folder? Thanks filth.
__________________ Encenta - Amazon Associates CMS | ||||
| |
| | #4 (permalink) |
| NamePros Expert Join Date: Nov 2003 Location: Scotland
Posts: 5,069
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | in versions above 4.1 you should be using $_FILES instead of $HTTP_POST_FILES try making path an absolute path on your server instead of relative to the script. Also in the query:- $query = "INSERT INTO files (id, title, file, artist, submit) VALUES ('', '$title', '$file', '$artist', '" . $_SESSION['logged_in'] . "')"; what are you trying to do? Are you actually trying to upload the file into the database or the name because that is not how you would go about inserting the name. It would also be a better idea to insert the details into the database after the file has been moved, there is more potential to go wrong with copying the file than there is uploading data to the database. Another note, have you checked the value of register globals as I have noticed you are using addslashes(). If register globals is turned on you could be causing problems with the script you should check the value of register globals THEn decide on how to treat the data. |
| |
| | THREAD STARTER #5 (permalink) | ||||
| SQLdumpster.com Join Date: Jun 2005 Location: West Sussex, UK
Posts: 573
![]() ![]() |
I'll try using $_FILES like you said. Thanks EDIT: Actually on second thoughts - my max upload limit is 2mb so that's kinda destroyed my idea of music downloads. Thanks anyway filth
__________________ Encenta - Amazon Associates CMS
Last edited by Encenta.com; 12-18-2005 at 07:14 AM.
| ||||
| |
| | #7 (permalink) | ||||
| Senior Member Join Date: Mar 2005
Posts: 4,948
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
PHP Code: | ||||
| |
| | #8 (permalink) |
| NamePros Expert Join Date: Nov 2003 Location: Scotland
Posts: 5,069
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | will setting it in the script have any affect?? Although some directives like this can be set per script they do not work. For example register_globals, changing this in the script has no affect as what the server does has already taken place by the time the script has run, I beleive it may be the same for upload_max_filesize. |
| |
| | #9 (permalink) |
| Senior Member Join Date: Mar 2005
Posts: 4,948
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | Also, you may have to change the post_max_size and/or memory_limit. They default to 8M. PHP Code: PHP Code: |
| |
| | #10 (permalink) |
| NamePros Expert Join Date: Nov 2003 Location: Scotland
Posts: 5,069
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | just had a look at http://uk.php.net/manual/en/ini.php#ini.list and upload_max_filesize can only be changed in php.ini, .htaccess or httpd.conf. The same goes for post_max_size |
| |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| ****HUGE List of FREE File/Image/Video Hosts!**** | thetzfreak | Free Resources | 31 | 02-12-2006 07:06 AM |
| Great Scripts for Sale With Resale Rights! | Zeeble | Scripts For Sale | 20 | 01-04-2006 02:39 AM |
| Googlism - What does google think of you? | deadserious | The Break Room | 55 | 12-15-2005 10:09 AM |
| Tutorial: How to Install Apache2 MySQL and PHP on Windows | deadserious | Webmaster Tutorials | 35 | 09-21-2005 10:46 PM |