Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[CONTRIBUTION] File uploads as an Option Feature


Guest

Recommended Posts

Hi,

 

I have successfully installed the upload contribution - works great!! Thanks Matt

 

However I cannot get the <Click to View>

to work - I have also tried the bug fix by Claus Christensen on 26th Aug 2004

Any Ideas??

 

Thanks in advance

 

Ali

 

Hi Again,

I have sorted it

 

I removed this part of the code in orders.php: AND o.products_options_name=

leaving the following code

if (isset($order->products[$i]['attributes']) && (sizeof($order->products[$i]['attributes']) > 0)) {
   for ($j = 0, $k = sizeof($order->products[$i]['attributes']); $j < $k; $j++) {

     // Customization #31101 for file_upload view begin
     $option = $order->products[$i]['attributes'][$j]['option'];
     ## Build a query to check if this option is of 'File' Type
     $file_check_sql = " select * from ".TABLE_PRODUCTS_OPTIONS ." o, ".TABLE_PRODUCTS_OPTIONS_TYPES." ot WHERE o.products_options_type = ot.products_options_types_id AND products_options_types_name='File".$option."'";

     $file_check_sql_query = tep_db_query($file_check_sql);
     $isFile = tep_db_num_rows($file_check_sql_query);

     if($isFile == 1 && @file_exists(DIR_FS_CATALOG_IMAGES_UPLOADS.$order->products[$i]['attributes'][$j]['value'])){
       $link = "<a href=". DIR_WS_CATALOG_IMAGES_UPLOADS.$order->products[$i]['attributes'][$j]['value']." target='_blank'><i><<b>Click Here to View File</b>></i></a>";
     }else {
        $link = "";
        }

     echo '<br><nobr><small> <i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ' . $order->products[$i]['attributes'][$j]['value'];

     if ($order->products[$i]['attributes'][$j]['price'] != '0') echo ' (' . $order->products[$i]['attributes'][$j]['prefix'] . $currencies->format($order->products[$i]['attributes'][$j]['price'] * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . ')';
     echo ' '. $link.' </i></small></nobr>';
      // Customization #31101 end
     }
}

 

It now works fine.

 

Ali_W

 

Note I also made the link stand out a bit better using <b> tag

Link to comment
Share on other sites

  • 3 weeks later...
  • Replies 482
  • Created
  • Last Reply

Top Posters In This Topic

I've read many comments about this error, but I still cant' figure it out. There error is...

 

Not writeable! DIR_FS_UPLOAD:

 

In configure.php, I've got

 

define('DIR_WS_UPLOADS', DIR_WS_IMAGES . 'uploads/');

define('DIR_FS_UPLOADS', DIR_FS_CATALOG . DIR_WS_UPLOADS);

 

And I've got the directory

 

/cart/images/uploads

 

writtable.

 

Please, what am I missing?

 

Thanks for the help. It's a great contribution and I've got the rest of it working fine.

 

Jim

Link to comment
Share on other sites

Hi

 

I've now managed to install the File Uploads PA contribution, including the option to store the real filename in the attribute.

 

The problem I'm having is that if, for example, a user uploads a file called

 

temp.pdf

 

then the filename displayed against the attribute might be

 

1. temp.pdf

 

However, the file is being stored on the server with the name

 

1

 

As a result of this, the "Click Here" link is never displayed (because it can't find the file) and there is no easy way to retrieve it.

 

Has anyone come across this and managed to resolve it?

 

Cheers

 

Richard

Link to comment
Share on other sites

Hi,

 

First of all, this is a great contribution!

 

Second: you re probably tired of reading these questions, I have no programming experience, just started with OScommerce and ran into this problem:

 

I installed the file feature .77, tried it by uploading one file and it worked fine.

After adding the file_upload.77_bugfixed_enhancement I tried uploading a fil again and get this message:

 

>>>>>

1062 - Duplicate entry '0' for key 1

 

insert into files_uploaded (sesskey, customers_id, files_uploaded_name) values('587a3e1d37730509a251275a1326c115', '2', 'Artwork6.jpg')

 

[TEP STOP]

>>>>>

 

Any idea where this is coming from?

Any further info you need for giving me advice?

 

Thanks so much for your help,

 

Uli

Link to comment
Share on other sites

I found out some more:

When I delete the first entry of "files_upload" from the database, it works. Whenever I upload a second file I get the error message.

 

Hi,

 

First of all, this is a great contribution!

 

Second: you re probably tired of reading these questions, I have no programming experience, just started with OScommerce and ran into this problem:

 

I installed the file feature .77, tried it by uploading one file and it worked fine.

After adding the file_upload.77_bugfixed_enhancement I tried uploading a fil again and get this message:

 

>>>>>

1062 - Duplicate entry '0' for key 1

 

insert into files_uploaded (sesskey, customers_id, files_uploaded_name) values('587a3e1d37730509a251275a1326c115', '2', 'Artwork6.jpg')

 

[TEP STOP]

>>>>>

 

Any idea where this is coming from?

Any further info you need for giving me advice?

 

Thanks so much for your help,

 

Uli

Link to comment
Share on other sites

I am having trouble with the .77 bugfixed enhancement. I have read this entire thread and tryed all fixes but none work for me.

 

My file uploads are working fine but when I go the edit order link I get this error:

 

1146 - Table 'getetched_com_-_oscommerce.products_options_types' doesn't exist

 

select * from products_options o, products_options_types ot WHERE o.products_options_type = ot.products_options_types_id AND products_options_types_name='File' AND o.products_options_name='Upload'

 

[TEP STOP]

 

 

The table IS defined as directed in the instructions.

Link to comment
Share on other sites

I do not know if any questions are being answered off the board here but I have a question.

 

I got the feature-.77 all installed and error FREE! it works like a charm.

 

Theres on small problem however.....NOTHING uploads. I also have read thru the forum and I do have not encountered any link that says "View Now."

Could someone please direct me in the correct direction to correct or figure out what is needed?

 

THanks in Advance

Link to comment
Share on other sites

I do not know if any questions are being answered off the board here but I have a question.

 

I got the feature-.77 all installed and error FREE! it works like a charm.

 

Theres on small problem however.....NOTHING uploads.  I also have read thru the forum and I do have not encountered any link that says "View Now."

Could someone please direct me in the correct direction to correct or figure out  what is needed?

 

THanks in Advance

 

 

Check your images/uploads dir to be sure it did not upload. You need to install the enhancement in order to view the file although that part isnt working for me.

 

You can find the enhancement on the contributions DL page

Link to comment
Share on other sites

I have read through all the threads but have been unable to come up with an answer.

 

The contribution was working successfully, but now no files are being uploaded. The contents of text boxes, check boxes and other attributes appear on the cart page, but for some reason, although I don't get any error messages, no files are being uploaded.

 

I checked the POST variable to see what is happening and this is what I get:

 

POST variables:

 

n

Array

(

[id] => Array

(

[txt_2] => D:\\Websites\image.gif

[5] => 1

[txt_7] => Happy Holidays!

)

 

[upload_1] => 2

[txt_upload_1] =>

[products_id] => 14

[number_of_uploads] => 1

[x] => 34

[y] => 9

)

 

 

 

 

so it looks like the [txt_upload_1] is empty, which I am assuming is causing the problem . I would be really grateful if anyone could give me any guidance on how to resolve this.

 

Thanks

Link to comment
Share on other sites

Re the above, I now realise I have been barking up the wrong tree!

 

I have looked again at the variables that are being passed and No $_FILES variables are being passed for some reason. Can anyone suggest a reason for this?

 

Many thanks

Link to comment
Share on other sites

Well, sorted.

 

In fact the problem was due to adding a form function, it stopped the form from uploading the file, nothing to do with the contribution, just my own inaccuracies.

 

Thanks a lot

Link to comment
Share on other sites

Check your images/uploads dir to be sure it did not upload.  You need to install the enhancement in order to view the file although that part isnt working for me.

 

You can find the enhancement on the contributions DL page

 

Also, there seems to be a problem with filenames containing spaces. Remove the space and DOT in the file name and it will work.

 

// In application_top.php:

//$real_ids[TEXT_PREFIX . $HTTP_POST_VARS[UPLOAD_PREFIX . $i]] = insert_id . ". " . $products_options_file->filename;

$real_ids[TEXT_PREFIX . $HTTP_POST_VARS[UPLOAD_PREFIX . $i]] = $insert_id . $products_options_file->filename;

 

Patrik

Link to comment
Share on other sites

Post # 46 of this thread

One little thing. Any tips on how to figure out which uploaded file(s) belong to which customers order? Everyone must want to do this, it would be ideal if the order ID was stamped on the files uploaded table I guess?

 

Any suggestions?

 

Glenn

 

Post # 47 of this thread (reply by Matt)

By default, if you look at the attributes in the customer's order, it will show #. image.ext.  The number is the file name of the image and the files_uploaded_id.  To go the other way, issue a

 

CODE

 

SELECT orders_id FROM orders_products_attributes WHERE products_options_values IS LIKE 1.%

Replace 1 with the actual files_uploaded_id.

 

Hth,

Matt 

 

My question:

Which file are these changes to take place? Has anyone had any luck naming images with the order # appended to it? Please help!

Link to comment
Share on other sites

  • 2 weeks later...
Hey Guys,

Is it possible to add a process bar to this great upload tool?

 

My clinents need to upload very large files and usually they don't have the patience to wait untill the upload is finished.

 

REgards,

As I recall, somewhere in this lengthy thread is that feature. You might want to skim through the thread looking for it. Or do a search like this:

 

+file +upload +option +progress and limit it to the Contribution Support forum

Rule #1: Without exception, backup your database and files before making any changes to your files or database.

Rule #2: Make sure there are no exceptions to Rule #1.

Link to comment
Share on other sites

  • 2 weeks later...

I have managed to get an image of the upload in the shopping cart from the discussion on page 5 ish.

 

The trouble is it not only inserts an image for the upload it makes all attributes into images.

 

Here is the code from my shopping_cart.php, I just cant seem to alter it to only display uploads.

 

thanks guys,,

 

mes

 while (list($option, $value) = each($products[$i]['attributes'])) {
         $products_name .= '<br><small><i> - ' . $products[$i][$option]['products_options_name'] . ' ' . $products[$i][$option]['products_options_values_name'] . '</i></small>';
   $products_name .= '<br>' . tep_image(DIR_WS_UPLOADS . $products[$i][$option]['products_options_values_name'], $products[$i][$option]['products_options_values_name'], 250, 150)  . '<br>';

Link to comment
Share on other sites

Not to sure, but i'm assuming I need to insert a while clause infront of this bit of code?

 

$products_name .= '<br>' . tep_image(DIR_WS_UPLOADS . $products[$i][$option]['products_options_values_name'], $products[$i][$option]['products_options_values_name'], 250, 150)  . '<br>';

 

somthing edited here?

 

while (list($option, $value) = each($products[$i]['attributes']))

 

thanks guys,

 

mes

Link to comment
Share on other sites

Yet another question by the resident question master:)

 

Is there any way to alter the file upload feature to check for image resolution, along with the file type of the image?

 

thanks again..

 

mes

Link to comment
Share on other sites

For those looking to add an upload progress window to the upload mod you can try the following. It seems to work and is simple to install.

 

 

 

The two image files that I used are from the "Menalto Gallery" project.

Right click and save from here or download the graphics from www.imijit.net/downloads/uploading.gif and www.imijit.net/downloads/computer.gif.

 

When you start your upload the popup box will appear. When the upload is finished and the product_info page is refreshed the box will close.

 

This is only tested when you do not show the shopping cart after adding the item. The window should close when the program closes but I have not tested it that way yet.

 

I hope that someone finds this useful.

 

Scott

 

 

Does anyone have the images that are listed in this post. The listed links are dead.

I could sure use them :thumbsup:

 

On a separate note. I have installed the update and the bug fix to show a link in admin for the uploaded image, Still no show link?? I also went through and did the update that was listed here and still no luck. Does anyone have this feature working or is the problem on my side??

Thanks Raymond

Link to comment
Share on other sites

  • 4 weeks later...
On a separate note. I have installed the update and the bug fix to show a link in admin for the uploaded image, Still no show link?? I also went  through and did the update that was listed here and still no luck. Does anyone have this feature working or is the problem on my side??

Thanks  Raymond

 

Has anyone got this to work?

I would live to see a copy of your admin/order.php file to see what i'm doing wrong.

Thanks in advance.

Raymond

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...