Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Know anything about the upload class?


blucollarguy

Recommended Posts

I am having trouble using the upload class from osC, at best I get the message "No file uploaded". It just won't upload. Updates the database no problem. This is being done on a new page in the admin I am writing and it is ticking me off. I had initially just written it thinking I knew what I was doing, but when it didn't work, I copied the code for the products_image from the "categories" file, and I am getting the same results.

 

Anyone have any ideas?

Craig :)

Happy Coding!

Craig Garrison Sr

Anything worth having, is worth working for.

Multi Vendor Shipping V1.1 Demo Catalog

3 Vendors, each category, "buy" a product from each category to see how MVS works during checkout.

Multi Vendor Shipping V1.1 Demo Admin

login: [email protected]

pass: mvs_demo

MVS Thread:

Multi-Vendor Shipping

My contribs:

Download Multi Vendor Shipping V1.1

Vendor Email

Vendor Info in easypopulate

EZ Price Updater

And more to come!

Link to comment
Share on other sites

Have you tried this page? http://www.oscommerce.info/kb/osCommerce/D...ction/Classes/9

 

Also, why don't you remove the page from your admin and see if it gets back to normal. There may be a coding error in the page or somewhere else.

 

Kevin

"What I didn't know yesterday, I know today & will remember tomorrow"

(By Kwalker)

 

What do you see when you open up the tep_database-pr2.2-CVS.pdf file that came with your osCommerce download?

Link to comment
Share on other sites

Have you tried this page? http://www.oscommerce.info/kb/osCommerce/D...ction/Classes/9

 

Also, why don't you remove the page from your admin and see if it gets back to normal. There may be a coding error in the page or somewhere else.

 

Kevin

Thanks for the reply Kevin, and Happy Holidays.

 

Yeah, I found that yesterday and worked with it. Same results. This page is in a contribution I have been working on, MVS. Trying to complete some updates. I have written my own upload pages before, not using the osC upload class and can get things done fine, but this needs to be osC compliant and it is really frustrating me, it just seems to make no sense.

 

Any suggestions on what might be breaking it?

 

Craig :)

Happy Coding!

Craig Garrison Sr

Anything worth having, is worth working for.

Multi Vendor Shipping V1.1 Demo Catalog

3 Vendors, each category, "buy" a product from each category to see how MVS works during checkout.

Multi Vendor Shipping V1.1 Demo Admin

login: [email protected]

pass: mvs_demo

MVS Thread:

Multi-Vendor Shipping

My contribs:

Download Multi Vendor Shipping V1.1

Vendor Email

Vendor Info in easypopulate

EZ Price Updater

And more to come!

Link to comment
Share on other sites

It may be a permissions problem. Check it out.

 

 

Kevin

"What I didn't know yesterday, I know today & will remember tomorrow"

(By Kwalker)

 

What do you see when you open up the tep_database-pr2.2-CVS.pdf file that came with your osCommerce download?

Link to comment
Share on other sites

It may be a permissions problem. Check it out.

Kevin

I was playing with that last night as well. The odd thing is that the exact same code(after the proper naming changes) works fine where it is already installed in the standard osC files. I just don't get it. Makes no sense.

 

Thanks for trying, any other ideas?

 

Craig :)

Happy Coding!

Craig Garrison Sr

Anything worth having, is worth working for.

Multi Vendor Shipping V1.1 Demo Catalog

3 Vendors, each category, "buy" a product from each category to see how MVS works during checkout.

Multi Vendor Shipping V1.1 Demo Admin

login: [email protected]

pass: mvs_demo

MVS Thread:

Multi-Vendor Shipping

My contribs:

Download Multi Vendor Shipping V1.1

Vendor Email

Vendor Info in easypopulate

EZ Price Updater

And more to come!

Link to comment
Share on other sites

Maybe the problem is in your naming convention somehow. You said that it works fine in the store when you change the name to one way, but not another. I'm thinking that the name you change it to and it doesn't work is because there is a file dependent on that file name, but since you've changed the filename, it can't find the needed file.

 

Just a thought.

 

 

Kevin

"What I didn't know yesterday, I know today & will remember tomorrow"

(By Kwalker)

 

What do you see when you open up the tep_database-pr2.2-CVS.pdf file that came with your osCommerce download?

Link to comment
Share on other sites

Maybe the problem is in your naming convention somehow. You said that it works fine in the store when you change the name to one way, but not another. I'm thinking that the name you change it to and it doesn't work is because there is a file dependent on that file name, but since you've changed the filename, it can't find the needed file.

 

Just a thought.

Kevin

Here's the code:

		// copy image only if modified
	$vendors_image = new upload('vendors_image');
	$vendors_image->set_destination(DIR_FS_CATALOG_IMAGES);

	if ($vendors_image->parse() && $vendors_image->save()) {
	  $vendors_image_name = $vendors_image->filename;
	} else {
	  $vendors_image_name = (isset($HTTP_POST_VARS['previous_vendors_image']) ? $HTTP_POST_VARS['previous_vendors_image'] : '');
	}

 

This is in the "update" switch. The input field is:

<tr>
		<td class="main"><?php echo TEXT_VENDORS_IMAGE; ?></td>
		<td class="main">
<?php

 //  echo tep_draw_file_field('vendors_image', $vInfo->vendors_image, 'maxlength="32"');

?><?php echo tep_draw_file_field('vendors_image') . '<br>' . tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . $vInfo->vendors_image . tep_draw_hidden_field('previous_vendors_image', $vInfo->vendors_image); ?></td>
	  </tr>

 

this should upload an image, but instead, all I get is an updated table when a file has been selected, but when a file is not selected the file name that was there get's wiped out, I have tried fixing that with

echo '<br>the image name ' . $HTTP_POST_VARS['vendors_image'];
	 echo '<br>the previous name ' . $HTTP_POST_VARS['previous_vendors_image'];
						 if (isset($HTTP_POST_VARS['vendors_image']) && tep_not_null($HTTP_POST_VARS['vendors_image']) && ($HTTP_POST_VARS['vendors_image'] != 'none')) {
		$sql_data_array['vendors_image'] = tep_db_prepare_input($HTTP_POST_VARS['vendors_image']);
	  }
	   if ($HTTP_POST_VARS['vendors_image'] == '') {
	  $sql_data_array['vendors_image'] = tep_db_prepare_input($HTTP_POST_VARS['previous_vendors_image']);
	  }

the "echo"s are just to make sure I have the data I think I should have and I do, but this simply isn't working.

Any more thoughts?

 

Craig <_<

Happy Coding!

Craig Garrison Sr

Anything worth having, is worth working for.

Multi Vendor Shipping V1.1 Demo Catalog

3 Vendors, each category, "buy" a product from each category to see how MVS works during checkout.

Multi Vendor Shipping V1.1 Demo Admin

login: [email protected]

pass: mvs_demo

MVS Thread:

Multi-Vendor Shipping

My contribs:

Download Multi Vendor Shipping V1.1

Vendor Email

Vendor Info in easypopulate

EZ Price Updater

And more to come!

Link to comment
Share on other sites

In your form you must have:

 

enctype="multipart/form-data"

 

Matti

Maaaaaaaaaaaan! That just might be it! How could I have not realised that? As many forms as I have written, I did not include that in the form declaration.

 

We will see, thanks Matti, as usual you have great information, Craig :)

Happy Coding!

Craig Garrison Sr

Anything worth having, is worth working for.

Multi Vendor Shipping V1.1 Demo Catalog

3 Vendors, each category, "buy" a product from each category to see how MVS works during checkout.

Multi Vendor Shipping V1.1 Demo Admin

login: [email protected]

pass: mvs_demo

MVS Thread:

Multi-Vendor Shipping

My contribs:

Download Multi Vendor Shipping V1.1

Vendor Email

Vendor Info in easypopulate

EZ Price Updater

And more to come!

Link to comment
Share on other sites

Sure enough Matti, that was it! I hate being stupid sometimes! :blush: :blink: :lol:

 

Thanks Matti, once again you have pushed me in the right direction. :thumbsup:

 

Craig :)

Happy Coding!

Craig Garrison Sr

Anything worth having, is worth working for.

Multi Vendor Shipping V1.1 Demo Catalog

3 Vendors, each category, "buy" a product from each category to see how MVS works during checkout.

Multi Vendor Shipping V1.1 Demo Admin

login: [email protected]

pass: mvs_demo

MVS Thread:

Multi-Vendor Shipping

My contribs:

Download Multi Vendor Shipping V1.1

Vendor Email

Vendor Info in easypopulate

EZ Price Updater

And more to come!

Link to comment
Share on other sites

  • 8 months later...
Maaaaaaaaaaaan! That just might be it! How could I have not realised that? As many forms as I have written, I did not include that in the form declaration.

 

We will see, thanks Matti, as usual you have great information, Craig :)

 

Hi blucollarguy, I really got to thank you on this one. I have seen many people having the upload problem, adding the

 

enctype="multipart/form-data"

 

really works! Thank you guys so much!

 

Jimbok

Link to comment
Share on other sites

  • 9 months later...

enctype="multipart/form-data"

 

You seem to have found a fix for this error which is bugging so many people. The problem I have now is not knowing where to insert this bit of code! Can anyone help?

 

Cheers,

 

Chris

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...