| |||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | #1 (permalink) |
| Barru. | Strange PHP error. PHP Code:
__________________ |
| |
| | #2 (permalink) |
| DNOA Member | ...what's your error?
__________________ codeboards A high-quality community of programmers -- Join today and post! We want new members! |
| |
| | #3 (permalink) |
| Barru. | sorry, should have metioned that. 1) it says all files i try to upload are over 1MB even when they're not. 2) it says the file upload failed if i disable the size checker. i havent found any more errors yet. incase you need it heres the HTML of the form on Home.php thats sending the file: Code: <form action="upload.php" method="post" enctype="multipart/form-data" name="form1">
<table width="414" border="0">
<tr>
<td width="158">File Location: </td>
<td width="246"><input name="file" type="file" id="file"></td>
</tr>
</table>
<p>* The file cannot exceed 1 mb.<br>
** Allowed file extensions are .gif, .jpg, .png and .bmp <br>
</p>
<p>
<input type="submit" name="Submit" value="Upload File">
</p>
</form>
__________________ Last edited by Mikor; 08-09-2005 at 08:13 AM. |
| |
| | #4 (permalink) |
| DNOA Member | Okay, so really what you want to do is fix the first error which will also fix the second one. Got it - you have <= in the size checker. You want >= ![]() *lol* right now it won't let files UNDER 1 MB in Yeah, change that
__________________ codeboards A high-quality community of programmers -- Join today and post! We want new members! |
| |
| | #5 (permalink) |
| Barru. | 1) ok, i tried what you said and it didnt work. 2) the size checker IF statement is PHP Code:
__________________ |
| |
| | #6 (permalink) |
| Professional Monkey | Its because the code you have is comparing the file name and not the file size try this: PHP Code:
__________________ [http://www.webmasterwords.com/python-split-and-join-examples]Python Tutorials[/url] |
| |
| | #7 (permalink) |
| Barru. | ahhhh, i knew it would be some stupid mistake (like all my mistakes in php) ok, I messed arround with the syntax and I got PHP Code: PHP Code:
__________________ Last edited by Mikor; 08-09-2005 at 08:27 AM. |
| |
| | #8 (permalink) |
| Professional Monkey | actaully i just realised my code is wrong it should be PHP Code:
__________________ [http://www.webmasterwords.com/python-split-and-join-examples]Python Tutorials[/url] Last edited by Amnezia; 08-09-2005 at 08:30 AM. |
| |
| | #9 (permalink) |
| DNOA Member | That's still checking to see if it's SMALLER than 1 MB. You need to reverse the <= to be >=.
__________________ codeboards A high-quality community of programmers -- Join today and post! We want new members! |
| |
| | #11 (permalink) |
| Professional Monkey | heres how i would test for the correct extension PHP Code:
__________________ [http://www.webmasterwords.com/python-split-and-join-examples]Python Tutorials[/url] |
| |
| | #12 (permalink) | |
| Barru. | Quote:
__________________ | |
| |
| | #13 (permalink) |
| DNOA Member | Just check the MIME type... it's more secure
__________________ codeboards A high-quality community of programmers -- Join today and post! We want new members! |
| |
| | #14 (permalink) |
| Eating Pie | PHP Code: PHP Code: Regards,
__________________ I feel old. |
| |
| | #15 (permalink) |
| Barru. | ok PHP Code: PHP Code: EDIT: ok, neither work, is it something wrong with my form? Code: <form action="upload.php" method="post" enctype="multipart/form-data" name="form1">
<table width="414" border="0">
<tr>
<td width="158">File Location: </td>
<td width="246"><input name="file" type="file" id="file"></td>
</tr>
</table>
<p>* The file cannot exceed 1 mb.<br>
** Allowed file extensions are .gif, .jpg, .png and .bmp <br>
</p>
<p>
<input type="submit" name="Submit" value="Upload File">
</p>
</form>
__________________ |
| |
| | #18 (permalink) |
| DNOA Member | Possible - : is an invalid character in filenames. When you go to rename the file to the date...
__________________ codeboards A high-quality community of programmers -- Join today and post! We want new members! |
| |
| | #19 (permalink) |
| Barru. | ok, i messed around with it (file extension still not working, so its disabled for now) heres teh current code PHP Code:
__________________ Last edited by Mikor; 08-09-2005 at 09:05 AM. |
| |
| | #20 (permalink) |
| Professional Monkey | ok this will work to check the extension PHP Code: full code PHP Code:
__________________ [http://www.webmasterwords.com/python-split-and-join-examples]Python Tutorials[/url] Last edited by Amnezia; 08-09-2005 at 09:09 AM. |
| |
| | #22 (permalink) |
| DNOA Member | ... use MIME detection! It's more secure!!
__________________ codeboards A high-quality community of programmers -- Join today and post! We want new members! |
| |
| | #23 (permalink) |
| Barru. | ok, ive fixed everything except the uploading, heres the script: PHP Code: Code: Warning: move_uploaded_file(/uploads/1353736806.bmp) [function.move-uploaded-file]: failed to open stream: No such file or directory in C:\ISC\upload.php on line 33 Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move 'C:\DOCUME~1\Boys\LOCALS~1\Temp\php86.tmp' to '/uploads/1353736806.bmp' in C:\ISC\upload.php on line 33
__________________ |
| |
| | #25 (permalink) |
| Barru. | yay! all working! but how would i replace the C:\ISC\Uploads\ to a relative directory e.g. \Uploads\ ? EDIT: ive changed the naming to PHP Code: PHP Code: also the search page dosnt work, heres the php: PHP Code:
__________________ Last edited by Mikor; 08-09-2005 at 10:26 AM. |
| |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Tutorial: Getting started with PHP (The Basics) | deadserious | Webmaster Tutorials | 60 | 11-17-2007 11:35 AM |
| Googlism - What does google think of you? | deadserious | The Break Room | 55 | 12-15-2005 09:09 AM |
| PHP Error | Unknown | Programming | 3 | 01-25-2005 09:06 PM |