Re: Uploading files

From: Date: Sun, 01 Jul 2001 11:18:04 +0000
Subject: Re: Uploading files
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-55725@lists.php.net to get a copy of this message
> I'm using a form to upload a number of files named $input_form_$i where $i > is from 0 to 5 and the following is my code: > > for ($i = 0; $i<=5; $i++){ > > $l = "input_form_$i"; > $location = $$l; > > move_uploaded_file($location, "$upload_path/$location_name"); ^^^^^^^^^^^^^^ Well,first, you're messed up with $location and $location_name, or would it be ${location}_name? And maybe, you might check what name were given to the form variables. > > } > with that, I get the following warnings: > > Warning: Unable to create '/': Invalid argument in [php file running > program] on line 64 > > Warning: Unable to move '/var/tmp//php9Uai9S' to '/' in [php file running > program] on line 64 > /var/tmp//php9Uai9S not loadable ^^ These double slashes make no sense in a filepath, beware of it if you move on. > > Funny thing is another page that doesn't use the $$l method to dynamically > grab variable names (just uses a static variable name) works totally fine > with essentially the same code. I think it is obvious that your dynamic variable-name handling breaks the code.

« previous php.general (#55725) next »