28, May 2012

Getting it to work... - webmaster forum

 
Webdigity webmaster forums
[ Home | Help | Search | Forum's Shop | Archive | Login | Register | Webmaster Directory ]
Webdigity Webmaster Forums  >  Web Development  >  PhP  >  PHP classes @finalwebsites.com  >  Easy PHP Upload (Moderator: Olaf)
Topic: Getting it to work...
« previous next »
Pages: [1] Print
Instabuck - The easy way to sell digital products online

Author Topic: Getting it to work...  (Read 3168 times)
Atari ST fan
*
Posts: 8
52 credits
Members referred : 0


« on: Aug 04, 2006, 06:17:51 pm »

Hi,

I'm very new to php, so perhaps I'm jumping in the deep end. Never-the-less, I'm not sure how to actually get this Easy PHP Upload to work on my website. Using the code I always get:

Notice: Undefined index: upload in */PHPdirectory/* on line 125
Notice: Undefined index: upload in */PHPdirectory/* on line 126
Notice: Undefined index: upload in */PHPdirectory/* on line 127

Which are the stared lines of this code respectively.
Code:
if (isset($_POST['Submit']) && $_POST['Submit'] == "Upload") {
1$foto_upload->the_temp_file = $_FILES['upload']['tmp_name']; *
$foto_upload->the_file = $_FILES['upload']['name'];                   *
$foto_upload->http_error = $_FILES['upload']['error'];1              *
$foto_upload->replace = (isset($_POST['replace'])) ? $_POST['replace'] : "n"; // because only a checked checkboxes is true
$foto_upload->do_filename_check = "n";
if ($foto_upload->upload()) {
$foto_upload->process_image(false, true, true, 80);
$foto_upload->message[] = "Processed foto: ".$foto_upload->file_copy."!"; // "file_copy is the name of the foto"
}
}

When I use the upload_example.php I don't get any errors, but it doesn't upload anything either.  Huh
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6691
34714 credits
Members referred : 374


It's time to use PHP5!


« Reply #1 on: Aug 04, 2006, 07:59:16 pm »

what is the upload form you are using? (only the code between the form tags)

Atari ST fan
*
Posts: 8
52 credits
Members referred : 0


« Reply #2 on: Aug 04, 2006, 11:55:50 pm »

On my page, I'm using:

Code:
<label for="category">Category of Photo</label>
<select name="category">
<option value="" seleced="selected">...</option>
<option value="More">More coming soon</option>
</select></div><br />

  <form action="uploadphp.php" method="post" enctype="multipart/form-data" name="form1">
<input type="hidden" name="MAX_FILE_SIZE" value="81920" />
<div>
  <label for="upload">Select a file</label>
  <input type="file" name="upload" id="upload" size="30" />
</div>

<div>
  <label for="replace">Replace?</label>
  <input type="checkbox" name="replace" id="replace" value="y" />
</div>

<div>
  <input type="submit" name="Submit" id="Submit" value="Upload" />
</div>
  </form>  
<p><?php echo $error?></p>

I adpated that from the script demo I believe.
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6691
34714 credits
Members referred : 374


It's time to use PHP5!


« Reply #3 on: Aug 05, 2006, 12:00:47 am »

is this part OK?

<form action="uploadphp.php"

Atari ST fan
*
Posts: 8
52 credits
Members referred : 0


« Reply #4 on: Aug 06, 2006, 03:06:24 pm »

is this part OK?

<form action="uploadphp.php"

Well.. uploadphp.php is the file that has the upload code in it. The form does call it. I changed the name from foto_upload.
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6691
34714 credits
Members referred : 374


It's time to use PHP5!


« Reply #5 on: Aug 06, 2006, 04:04:09 pm »

is this part OK?

<form action="uploadphp.php"
do you
Well.. uploadphp.php is the file that has the upload code in it. The form does call it. I changed the name from foto_upload.
please post the whole file here (as an attachment)

Atari ST fan
*
Posts: 8
52 credits
Members referred : 0


« Reply #6 on: Aug 07, 2006, 04:42:06 pm »

Uploaded as a txt file, since you can't upload php. But no problem there really.

* uploadphp.txt (8.45 KB - downloaded 3 times.)
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6691
34714 credits
Members referred : 374


It's time to use PHP5!


« Reply #7 on: Aug 07, 2006, 08:10:49 pm »

works fine (windows and linux)

the only thing that looks strange are these rows:
Code:
$foto_upload->foto_folder = $_SERVER['DOCUMENT_ROOT']."//pictures/upload/photo/";
$foto_upload->thumb_folder = $_SERVER['DOCUMENT_ROOT']."//pictures/upload/thumb/";

not the double slashes, please post url where the file have to work...

Atari ST fan
*
Posts: 8
52 credits
Members referred : 0


« Reply #8 on: Aug 08, 2006, 06:53:22 pm »

http://www.yumc.co.uk/uploadphp.php

That's the page where users will be able to upload pictures.. It isn't correctly linked from the rest of the website yet which is about to have a major update to it.

Have I got it set up to use a Database? Because I haven't created a database for it to use..
« Last Edit: Aug 08, 2006, 07:10:11 pm by HailandKill »
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6691
34714 credits
Members referred : 374


It's time to use PHP5!


« Reply #9 on: Aug 08, 2006, 11:55:22 pm »

No there is no database needed, I used your file on my local server without changes and it worked fine.

You are saying that the orgininal example is working on this server? please show me this file too (just change the pathes for the upload)

Atari ST fan
*
Posts: 8
52 credits
Members referred : 0


« Reply #10 on: Aug 09, 2006, 01:30:27 am »

The following files for easy upload are on my server are:

www.yumc.co.uk/uploadphp.php
www.yumc.co.uk/classes/upload/upload_class.php

Also, I have the example code uploaded at www.yumc.co.uk/upload_example.php

While the upload_example doesn't give any errors, new pictures appear to be uploaded into the directory.

I have PHP Version 4.4.2 installed.. not sure whether that's a problem. More server info can be found at www.yumc.co.uk/info.php
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6691
34714 credits
Members referred : 374


It's time to use PHP5!


« Reply #11 on: Aug 09, 2006, 08:02:28 am »

I can't see what is the problem:

Quote
While the upload_example doesn't give any errors, new pictures appear to be uploaded into the directory.

it doesn't work for me  Sad

after the upload there must be an success message.

EDIT: one is strange here, this is what I get if I upload with you modified version:

Notice: Undefined index: upload in /usr/local/home/httpd/vhtdocs/yumc.co.uk/uploadphp.php on line 125

Notice: Undefined index: upload in /usr/local/home/httpd/vhtdocs/yumc.co.uk/uploadphp.php on line 126

Notice: Undefined index: upload in /usr/local/home/httpd/vhtdocs/yumc.co.uk/uploadphp.php on line 127

Atari ST fan
*
Posts: 8
52 credits
Members referred : 0


« Reply #12 on: Aug 09, 2006, 04:13:45 pm »

I can't see what is the problem:

Quote
While the upload_example doesn't give any errors, new pictures appear to be uploaded into the directory.

it doesn't work for me  Sad

That was actually a typo for me.. I meant to say new pictures don't appear.

Those were also the errors that I got. All I can think of now is that there is something wrong with the PHP on my server. I don't suppose if I'd have my php.ini file configured incorrectly things would go wrong..? Although a phpBB forum works happily on the same forum.

It's these three lines it doesn't like:

Code:
$foto_upload->the_temp_file = $_FILES['upload']['tmp_name'];
$foto_upload->the_file = $_FILES['upload']['name'];
$foto_upload->http_error = $_FILES['upload']['error'];
« Last Edit: Aug 09, 2006, 04:18:28 pm by HailandKill »
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6691
34714 credits
Members referred : 374


It's time to use PHP5!


« Reply #13 on: Aug 09, 2006, 05:12:56 pm »



That was actually a typo for me.. I meant to say new pictures don't appear.

Those were also the errors that I got. All I can think of now is that there is something wrong with the PHP on my server. I don't suppose if I'd have my php.ini file configured incorrectly things would go wrong..? Although a phpBB forum works happily on the same forum.

It's these three lines it doesn't like:

Code:
$foto_upload->the_temp_file = $_FILES['upload']['tmp_name'];
$foto_upload->the_file = $_FILES['upload']['name'];
$foto_upload->http_error = $_FILES['upload']['error'];

the code above is really standaard...it looks to me that these array isn't accepted, place the code above the three rows:
Code:
print_r($_FILES);

and then try this old fashioned code:

Code:
print_r($HTTP_POST_FILES);

and tell me what you see...

Atari ST fan
*
Posts: 8
52 credits
Members referred : 0


« Reply #14 on: Aug 09, 2006, 05:16:08 pm »

I think I've found the problem... in the php.ini file it said

file_uploads = Off

I have now changed this to file_uploads = On and it is now uploading!

I feel a little stupid for not checking there, thanks for all the help you've been giving me, olaf!
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6691
34714 credits
Members referred : 374


It's time to use PHP5!


« Reply #15 on: Aug 09, 2006, 05:56:54 pm »

Wink
Quote
I feel a little stupid for not checking there, thanks for all the help you've been giving me, olaf!
you know where to find the donation links on my site Smiley

Trackback URI for this entry : http://www.webdigity.com/trackback.php?topic=3546
Tags : php forums phpBB databases php.ini Bookmark this thread : Digg Del.icio.us Dzone more....

Pages: [1] Print 
Webdigity Webmaster Forums  >  Web Development  >  PhP  >  PHP classes @finalwebsites.com  >  Easy PHP Upload (Moderator: Olaf)
Topic: Getting it to work...
« previous next »
Jump to:
User Area
Welcome, Guest. Please login or register.
Did you miss your activation email?
May 28, 2012, 02:49:01 pm





Login with username, password and session length

Donate to our community, and get a permanent link back to your site!

Donate to our community, and get a permanent link back to your site!






Web Design Gallery · Whois Lookup · Pagerank · Tag Browsing · Lo-fi version · Syndication · Webmaster forum history · Advertise
Developed by HumanWorks © 2005 - 2012 Webdigity webmaster community · sublime directory
Webdigity Webmaster Forums | Powered by SMF 1.0.12. © 2001-2005, Lewis Media. All Rights Reserved.