| | |||||
| ||||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | THREAD STARTER #1 (permalink) |
| Senior Member Join Date: Aug 2005 Location: East Yorkshire, England
Posts: 2,689
![]() ![]() ![]() ![]() ![]() ![]() ![]() | Strange PHP error.PHP Code: |
| |
| | THREAD STARTER #3 (permalink) |
| Senior Member Join Date: Aug 2005 Location: East Yorkshire, England
Posts: 2,689
![]() ![]() ![]() ![]() ![]() ![]() ![]() | 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. ????: NamePros.com http://www.namepros.com/showthread.php?t=114050 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 09:13 AM.
|
| |
| | THREAD STARTER #5 (permalink) |
| Senior Member Join Date: Aug 2005 Location: East Yorkshire, England
Posts: 2,689
![]() ![]() ![]() ![]() ![]() ![]() ![]() | 1) ok, i tried what you said and it didnt work. 2) the size checker IF statement is PHP Code: |
| |
| | #6 (permalink) |
| Professional Monkey Join Date: Jul 2005 Location: Escaped from the zoo
Posts: 907
![]() ![]() | Its because the code you have is comparing the file name and not the file size try this: PHP Code:
__________________ Webmaster Words |
| |
| | THREAD STARTER #7 (permalink) |
| Senior Member Join Date: Aug 2005 Location: East Yorkshire, England
Posts: 2,689
![]() ![]() ![]() ![]() ![]() ![]() ![]() | 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: ????: NamePros.com http://www.namepros.com/showthread.php?t=114050 PHP Code:
Last edited by Mikor; 08-09-2005 at 09:27 AM.
|
| |
| | #8 (permalink) |
| Professional Monkey Join Date: Jul 2005 Location: Escaped from the zoo
Posts: 907
![]() ![]() | actaully i just realised my code is wrong it should be PHP Code:
__________________ Webmaster Words
Last edited by Amnezia; 08-09-2005 at 09:30 AM.
|
| |
| | #11 (permalink) |
| Professional Monkey Join Date: Jul 2005 Location: Escaped from the zoo
Posts: 907
![]() ![]() | heres how i would test for the correct extension PHP Code:
__________________ Webmaster Words |
| |
| | THREAD STARTER #12 (permalink) | ||||
| Senior Member Join Date: Aug 2005 Location: East Yorkshire, England
Posts: 2,689
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
| ||||
| |
| | #14 (permalink) |
| Eating Pie Join Date: Nov 2004 Location: Canada
Posts: 2,272
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | PHP Code: PHP Code: Regards,
__________________ I feel old. |
| |
| | THREAD STARTER #15 (permalink) |
| Senior Member Join Date: Aug 2005 Location: East Yorkshire, England
Posts: 2,689
![]() ![]() ![]() ![]() ![]() ![]() ![]() | 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> |
| |
| | #16 (permalink) |
| Professional Monkey Join Date: Jul 2005 Location: Escaped from the zoo
Posts: 907
![]() ![]() | I think it could be because your trying to create a file with a : in the name
__________________ Webmaster Words |
| |
| | THREAD STARTER #19 (permalink) |
| Senior Member Join Date: Aug 2005 Location: East Yorkshire, England
Posts: 2,689
![]() ![]() ![]() ![]() ![]() ![]() ![]() | 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 10:05 AM.
|
| |
| | #20 (permalink) |
| Professional Monkey Join Date: Jul 2005 Location: Escaped from the zoo
Posts: 907
![]() ![]() | ok this will work to check the extension PHP Code: full code PHP Code:
__________________ Webmaster Words
Last edited by Amnezia; 08-09-2005 at 10:09 AM.
|
| |
| | THREAD STARTER #23 (permalink) |
| Senior Member Join Date: Aug 2005 Location: East Yorkshire, England
Posts: 2,689
![]() ![]() ![]() ![]() ![]() ![]() ![]() | 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 |
| |
| | THREAD STARTER #25 (permalink) |
| Senior Member Join Date: Aug 2005 Location: East Yorkshire, England
Posts: 2,689
![]() ![]() ![]() ![]() ![]() ![]() ![]() | 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 11: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 12:35 PM |
| Googlism - What does google think of you? | deadserious | The Break Room | 55 | 12-15-2005 10:09 AM |
| PHP Error | Unknown | Programming | 3 | 01-25-2005 10:06 PM |