Problem With files

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!

Moderator: General Moderators

danharibo
Forum Commoner
Posts: 76
Joined: Thu Aug 17, 2006 8:56 am

Post by danharibo »

But there is! Its part of the form, look:

stupid php
Last edited by danharibo on Thu Sep 21, 2006 11:57 am, edited 1 time in total.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Read up on file uploads in PHP. There is something that is missing in your form that is shown in the example in that link I posted.
danharibo
Forum Commoner
Posts: 76
Joined: Thu Aug 17, 2006 8:56 am

Post by danharibo »

Code: Select all

<form enctype="multipart/form-data" action="upload.php" method="POST">
    <!-- MAX_FILE_SIZE must precede the file input field -->
    <input type="hidden" name="MAX_FILE_SIZE" value="30000" />
    <!-- Name of input element determines name in $_FILES array -->
    File to upload: <input name="uploadFile" type="file" />
    <input type="submit" value="Upload File" />
</form>
<?
Still causes:

Notice: Undefined index: uploadFile in c:\program files\easyphp1-8\www\upload\upload.php on line 4

Notice: Undefined index: uploadFile in c:\program files\easyphp1-8\www\upload\upload.php on line 4

Notice: Undefined index: uploadFile in c:\program files\easyphp1-8\www\upload\upload.php on line 7

Notice: Undefined variable: uploadedfile in c:\program files\easyphp1-8\www\upload\upload.php on line 9
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Just on a side note, are you checking if the form was posted anywhere in your code?
danharibo
Forum Commoner
Posts: 76
Joined: Thu Aug 17, 2006 8:56 am

Post by danharibo »

nevermind, fixed :)
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

What was the fix?
Post Reply