Jump to content


Img Upload


  • You cannot reply to this topic
6 replies to this topic

#1 carli

    Etomite Forum Newbie

  • Member
  • 30 posts

Posted 21 February 2006 - 06:41 AM

I have problem to run this .... any idea ?

$echo1 .= "<form name='form1' method='post' action='' enctype='multipart/form-data'>
<input type='file' name='imagefile'>
<br>
<input type='submit' name='Submit' value='Submit'>"; 
return $echo1;

//text set
$echo3 = "prevelika slika";
$echo5 = "Shranjevanje končano!....";

if(isset( $Submit )){
//If the Submitbutton was pressed do:
if ($_FILES['imagefile']['type'] == "image/gif"){
if ($_FILES['imagefile']['size'] > 100000){return $echo3;}
else{
copy ($_FILES['imagefile']['tmp_name'], "files/".$_FILES['imagefile']['name']);
return $echo5;
}
}

elseif ($_FILES['imagefile']['type'] == "image/jpeg"){
if ($_FILES['imagefile']['size'] > 100000){return $echo3;}
else{
copy ($_FILES['imagefile']['tmp_name'], "files/".$_FILES['imagefile']['name']);
return $echo5;
}
}}

$echo2 = "</form>";
return $echo2;

Edited by carli, 21 February 2006 - 06:41 AM.


#2 Ralph

    Loves Etomite Forums!

  • Admin
  • 6,524 posts
  • Gender:Male

Posted 21 February 2006 - 02:21 PM

Without the need to run the snippet, what error(s) are you receiving...??? Also, have you increased the php.ini limit for uploads from the default of 2M to 10M...???

#3 carli

    Etomite Forum Newbie

  • Member
  • 30 posts

Posted 22 February 2006 - 06:51 AM

Yee well I don't get errors ... that's my problem ... I know about php.ini ....

#4 mikef

    Loves Etomite Forums!

  • Member
  • PipPipPipPip
  • 1,551 posts

Posted 22 February 2006 - 11:14 AM

Well, without any indication of what the problem is, and what your setup is, its possible you aren't going to get a lot of helpful anwsers :betterwink:

However, with that code as it stands, I don't think its ever going to get past
return $echo1;
unless I've misread it.

#5 Ralph

    Loves Etomite Forums!

  • Admin
  • 6,524 posts
  • Gender:Male

Posted 22 February 2006 - 02:17 PM

mikef, on Feb 22 2006, 07:14 AM, said:

Well, without any indication of what the problem is, and what your setup is, its possible you aren't going to get a lot of helpful anwsers  :betterwink:

However, with that code as it stands, I don't think its ever going to get past
return $echo1;
unless I've misread it.
Although the use of $echo within a string variable isn't exactly good practice, it will work... I almost thought it wouldn't work too, but after taking a second glance I realized that the echo was part of a variable... I just tossed $echo1 into a snippet I was testing and it did, in fact, work so the problem lies elsewhere...

#6 mikef

    Loves Etomite Forums!

  • Member
  • PipPipPipPip
  • 1,551 posts

Posted 22 February 2006 - 02:22 PM

Ralph (rad14701), on Feb 22 2006, 02:17 PM, said:

Although the use of $echo within a string variable isn't exactly good practice, it will work... I almost thought it wouldn't work too, but after taking a second glance I realized that the echo was part of a variable... I just tossed $echo1 into a snippet I was testing and it did, in fact, work so the problem lies elsewhere...

No, the point is that the 'return echo1;' is unconditional, so the rest of the snippet will never be executed.

#7 Ralph

    Loves Etomite Forums!

  • Admin
  • 6,524 posts
  • Gender:Male

Posted 22 February 2006 - 03:36 PM

mikef, on Feb 22 2006, 10:22 AM, said:

No, the point is that the 'return echo1;' is unconditional, so the rest of the snippet will never be executed.
DOH...!!! :o I really do need to get that eye exam scheduled... :blink:





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users