Quantcast
Channel: PHP Freaks: PHP Help
Viewing all articles
Browse latest Browse all 13200

Small code - small problem - can't find it!

$
0
0

Hey :) Wondered if anyone could help me with this. I had this right a couple of days ago but for some reason it wasn't in my code yesterday and since rebuilding, has ceased to work.

 

I have a multi file upload that creates a directory as the name of the username variable ($username_entry).

 

When using this variable in the file path along with the variable for the name of the file ($name) the file path simply puts the variable text "$name" as some random blank file within the newly created directory.

 

Im sure it something pretty small that needs editing to use 2 variables in 1 path.

 

 

Anyway here's the code i need tweaking. Thanks to anyone that can help me :)

 

 

<?php
 
if (isset($_FILES['upload']) === true) {
$files = $_FILES['upload'];
 
 
for($x = 0; $x < count($files['name']); $x++) {
$name = $files['name'][$x];
$tmp_name = $files['tmp_name'][$x];
 
move_uploaded_file($tmp_name, 'user_images/'.$username_entry.'/ . $name');
 
}
 
?>
 
Its the move_uploaded_file($tmp_name, 'user_images/'.$username_entry.'/ . $name'); where i think the problem lies.......any takers?
 
 
Thanks. :)

Viewing all articles
Browse latest Browse all 13200

Trending Articles