[SOLVED] uploaded 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

Post Reply
User avatar
ol4pr0
Forum Regular
Posts: 926
Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador

[SOLVED] uploaded files

Post by ol4pr0 »

Oke.. here it is.

upload should work, it worked before. ( if i access the page directly is works aswell. )

However i have included the page.

all form field values are being returned with print_r, so nothing wrong there.
uploaded files is going badly.

Code: Select all

print_r ($_FILES['foto']);
#returned
Array ( [name] => book.png [type] => image/png [tmp_name] => C:\WINNT\TEMP\php1D.tmp [error] => 0 [size] => 4407 )
However the following code says otherwise

Code: Select all

#before i had $HTTP_POST_FILES instead of whats below
#thought maby it had something to do with that.

	if (isset($_HTTP_POST_FILES['curriculum']['name'])) $file_name2 = $_HTTP_POST_FILES['curriculum']['name'];
		else $file_name2 = "";
	if (isset($_HTTP_POST_FILES['curriculum']['size'])) $file_size2 = $_HTTP_POST_FILES['curriculum']['size'];
		else $file_size2 = "";
	if (isset($_HTTP_POST_FILES['curriculum']['tmp_name'])) $file_tmp2 = $_HTTP_POST_FILES['curriculum']['tmp_name'];
		else $file_tmp2 = "";
	
	if (isset($_HTTP_POST_FILES['foto']['name'])) $file_name = $_HTTP_POST_FILES['foto']['name'];
		else $file_name = "";
	if (isset($_HTTP_POST_FILES['foto']['size'])) $file_size = $_HTTP_POST_FILES['foto']['size'];
		else $file_size = "";
	if (isset($_HTTP_POST_FILES['foto']['tmp_name'])) $file_tmp = $_HTTP_POST_FILES['foto']['tmp_name'];
		else $file_tmp = "";
		
	
	#fotito
	if (($file_name == "")||($file_size == "")||($file_tmp == "")) {
	echo '¿ El fotito ?<br>';
	}
	#Hoja de Vida
	if (($file_name2 == "")||($file_size2 == "")||($file_tmp2 == "")) {
	echo '<br>¿Olvidaste El Curriculum?<br>';
	}
#being returned on screen.
¿El fotito?

¿El Curriculum?
User avatar
ol4pr0
Forum Regular
Posts: 926
Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador

Post by ol4pr0 »

I figured it out..

using

Code: Select all

$_FILES['curriculum']['name']
However understanding it i do not.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

$HTTP_POST_FILES is the correct OLD form.. $_FILES is the correct NEW form.
Post Reply