jbegreen Posted May 31, 2013 Share Posted May 31, 2013 Hey Guys, I have an Array Count On file uploads (Upto 5 Files) Called Upload[0]; Is this right to use an individual filename from the array as a variable? $image_upload1 = $_POST['upload'[0]; As i want to use is in this... $insert_upload1 = "user_images/$username_entry/$image_upload1"; As $insert_upload1 is the variable for an INSERT value on my Database. I think its something in the display of the 'upload[ ] array. Can anyone shed any light Thanks Link to comment https://forums.phpfreaks.com/topic/278636-whats-wrong-with-this/ Share on other sites More sharing options...
boompa Posted May 31, 2013 Share Posted May 31, 2013 $image_upload1 = $_POST['upload'[0]; Do you see a problem there? Or is this not your actual code, and you added a typo? One of the first things to learn is how to debug your code. You can do this here by printing the value of the $_POST array with var_dump($_POST); Does it display what you expect? Link to comment https://forums.phpfreaks.com/topic/278636-whats-wrong-with-this/#findComment-1433402 Share on other sites More sharing options...
jbegreen Posted May 31, 2013 Author Share Posted May 31, 2013 The array displays fine, I'm trying to assign the 0 elements to a variable. Link to comment https://forums.phpfreaks.com/topic/278636-whats-wrong-with-this/#findComment-1433404 Share on other sites More sharing options...
boompa Posted May 31, 2013 Share Posted May 31, 2013 What is the content of $_POST['upload'][0]? Link to comment https://forums.phpfreaks.com/topic/278636-whats-wrong-with-this/#findComment-1433406 Share on other sites More sharing options...
jbegreen Posted May 31, 2013 Author Share Posted May 31, 2013 just says submit Link to comment https://forums.phpfreaks.com/topic/278636-whats-wrong-with-this/#findComment-1433414 Share on other sites More sharing options...
jbegreen Posted May 31, 2013 Author Share Posted May 31, 2013 solved it a different way. You were right, by using a print_r i could get to the bottom of it $image_upload1 = ($files['name'][0]); thanks. Link to comment https://forums.phpfreaks.com/topic/278636-whats-wrong-with-this/#findComment-1433415 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.