68 replies [Last post]
tembenite's picture
Offline
Joined: 08/15/2010
Juice: 64
Was this information Helpful?

Hello,

A few days ago I was very new to UberCart. After messing with the code for a few days, I really like this!

In any case, I have completed 90% of the updates needed to add the ability to upload a file as an attribute, but I'm running into a hitch.

So far I've done the following:
* Added a new a attribute option "User File Upload" which presents a form to the user.
* Modified this form so that it properly submits multipart data.
* Created a value callback function that creates a link to a token for a "Download Link for user 0 (Effectively hiding the download from the "My Download" links.
* Created a validation function which validates the files, moves them under the download links, and creates an entry in the uc_file_users table with the same token originally used in the value callback.

This all works beautifully with one small hitch.... the link I've added for the "Attributes" is getting escaped, so instead of a link its showing as the actual text of the link.

If I actually copy and paste the link out of the escaped HTML, it does in fact function properly downloading the file. As a result the issue appears to just be a display issue.

Once this last piece is working, all I need to do is code a little cleanup to clear out all of the files in the upload section that no longer has to do with a shopping cart and it should be ready to rock and roll.

Thanks,
Doug

tembenite's picture
Offline
Joined: 08/15/2010
Juice: 64
Links
tembenite's picture
Offline
Joined: 08/15/2010
Juice: 64
Re: Handling a Print Shop with custom image uploads

Well rather that write a module I've decided to attempt to modify the Uber Cart source, in hopes of later getting these changes into the existing UberCart modules, since there seems quite a few people interested in this based on prior threads and this seems like the type of thing that should be easy out-of-the-box.

As a result I've added a new type of attribute "User File Upload" (4) to _uc_attribute_display_types.

I've modified the code to allow for this new entry within _uc_attribute_display_types.

In addition I've added a bit of code to uc_product_add_to_cart_form so that the form is changed to a multipart form if it has a "User File Upload" item within it.

As a result of these changes I now have a file browser displaying properly as an attribute on an item, I can select a file, and I have confirmed that the file contents are sent as part of the POST request due to the multipart form.

Where I am stuck is in figuring out where/what I need to modify in order to get access and store the file that is sent. It is my plan to save the upload to disk, and then reference it within the attribute information, must like the textbox comment is now stored.

In looking through the $form_state variable I'm not seeing anything referencing the POSTed file, nor have I been able to track down where $form_state appears to be initially populated with the information from the $_POST.

If anyone can assist in pointing me in the right direction, I'd greatly appreciate it.

tembenite's picture
Offline
Joined: 08/15/2010
Juice: 64
Re: Re: Handling a Print Shop with custom image uploads

.

tembenite's picture
Offline
Joined: 08/15/2010
Juice: 64
Re: Handling a Print Shop with custom image uploads

Well rather that write a module I've decided to attempt to modify the Uber Cart source, in hopes of later getting these changes into the existing UberCart modules, since there seems quite a few people interested in this based on prior threads and this seems like the type of thing that should be easy out-of-the-box.

As a result I've added a new type of attribute "User File Upload" (4) to _uc_attribute_display_types.

I've modified the code to allow for this new entry within _uc_attribute_display_types.

In addition I've added a bit of code to uc_product_add_to_cart_form so that the form is changed to a multipart form if it has a "User File Upload" item within it.

As a result of these changes I now have a file browser displaying properly as an attribute on an item, I can select a file, and I have confirmed that the file contents are sent as part of the POST request due to the multipart form.

Where I am stuck is in figuring out where/what I need to modify in order to get access and store the file that is sent. It is my plan to save the upload to disk, and then reference it within the attribute information, must like the textbox comment is now stored.

In looking through the $form_state variable I'm not seeing anything referencing the POSTed file, nor have I been able to track down where $form_state appears to be initially populated with the information from the $_POST.

If anyone can assist in pointing me in the right direction, I'd greatly appreciate it.

tembenite's picture
Offline
Joined: 08/15/2010
Juice: 64
Re: Re: Handling a Print Shop with custom image uploads

Figures as soon as I posted this I find the entries I need in form.inc, not that it seems that there is anyone else reading this thread to even comment.

In any case, this should take me to the next steps.

tembenite's picture
Offline
Joined: 08/15/2010
Juice: 64
Re: [Almost Complete] - Handling upload of file as an attribute

Coding is just about complete besides some minor error checking.

I will likely be turning this into a contrib.

rhill's picture
Offline
Joined: 09/09/2010
Juice: 15
What is the ETA?

Hi,

I read the post and really need this feature. When do you think you will have it available? Do you have a beta that I can try?

Thanks,
Randy

tembenite's picture
Offline
Joined: 08/15/2010
Juice: 64
Randy, Sure thing, a

Randy,
Sure thing, a beta version can be found here:

http://www.dlogan.net/drupal/uc_attribute_files_Beta_0.10.tar.gz

I've gotten kind of side-tracked and haven't finished the last few things lately, but I was looking to get back to this hopefully sometime this weekend.

Thanks,
Doug

tembenite's picture
Offline
Joined: 08/15/2010
Juice: 64
Beta version 0.50
brisuc's picture
Offline
Joined: 01/21/2010
Juice: 11
Re: Beta version 0.50

I just tried out this module...

AND lost about 189 gigabytes of data off my pc, and about 200 gigabytes off my laptop... There is unlink code in the module which randomly deletes everything! Grrrrr

Now i don't even know if i will be able to get everything back :\

rhill's picture
Offline
Joined: 09/09/2010
Juice: 15
Re: [Almost Complete] - Handling upload of file as an attribute

Thanks for the link, I installed it, but there is no option for the display it just shows a text input field, and no way to browse for files to upload. Any help would be appreciated.

Thanks,
Randy

tembenite's picture
Offline
Joined: 08/15/2010
Juice: 64
Randy, What version of

Randy,
What version of Drupal are you using? I coded that on the latest version of Drupal 6.x. I have not tested it on any other release of Drupal.

It is possible you might also be running into a bug I discovered last night.

Creating the attributes within:
Administer -> Store Administration -> Attributes

And then creating a product and assigning them appears to work.

Editing a product directly and adding/modifying an attribute appears to not have the "File Upload" in the selection box which is resulting in the attribute being defaulted to a text box.

You can fix this by manually editing the database table uc_product_attributes and changing the display value to 4 for all "File Upload" attributes.

I should have that fixed and a number of other enhancements published soon.

Thanks,
Doug

rhill's picture
Offline
Joined: 09/09/2010
Juice: 15
Hello

Hi Doug,

I am running on the 6.19 build. I tried changing the display value to 4 in the db, but still have the text field displaying.

In the uc_attributes the display is 4
In the uc_product_attributes display is 4

Any other suggestion?

Thanks,
Randy

tembenite's picture
Offline
Joined: 08/15/2010
Juice: 64
Re: Hello

Within the uc_attribute_files.module file there is a function:

uc_attribute_files_form_alter

Within that you should see the following three lines:
$form['attributes'][$id]['#type'] = 'file';
$form['attributes'][$id]['#name'] = "files[" . check_plain($form['node']['#value']->attributes[$id]->name) . "]";
$form['attributes'][$id]['#value_callback'] = "uc_attribute_files_value_callback";

These are what should be modifying the text boxes to the "file" format input box.

If you add the following after those three lines:

print_r($form['attributes'][$id]);

It should print out the entire object when you go to view the page of an item that has a file attribute.

Do a view source and copy the output before the start of the html document HTML, and upload that output here and I can see if I can tell what is going on.

Otherwise I should have another release of this plugin sometime tonight. I still may not have the bug from editing a product directly fixed yet, but there have been a lot of error checking and other enhancements between what I have now, and what I have on my website right now. As a result there is a reasonable chance I might have fixed the problem already.

Thanks,
Doug Logan

rhill's picture
Offline
Joined: 09/09/2010
Juice: 15
Test results

Hi Doug,

I installed the new beta and the browse button showed up, tho I still have to go to the database and update the display to 4. When I am in the edit -> product ->attribute there is no selection for image upload it defaults to the text field.

However it only shows up in IE8 & Firefox 3.6.9, it does not even show the field in Chrome 6, Opera 10.62 or Safari 4.0.5

I also got this message "Upload to directory failed. Please contact an administrator." Where does it upload the image to? Do I need to create a directory?

Also, if you need a bit of help I can give you a hand like Julio.

How I hate Drupal core team for hard coding the with the size of "60", completely screws up the design layout I am working with. Can anyone tell me where that is located so I can change it? I used the field_length_module and it works fine for text fields, but not the upload file field. Sad I might have to go back to Joomla

Thank you,
Randy

tembenite's picture
Offline
Joined: 08/15/2010
Juice: 64
Randy, Yeah, I didn't

Randy,
Yeah, I didn't have enough time last night to fix that bug yet, so the display under "Edit->Product->attribute" is the expected behavior at this point. I think I'm going to have time this evening to work on that more, but we'll see.

Interesting, I'll have to test in Chrome and Opera. I've done all my testing in Firefox and IE so far. I would think the HTML code generated would be browser independent, but maybe Drupal is doing something else behind the scenes.

Yes, you need to configure directories for the files to be uploaded. I don't have my drupal install easily available right now, but the settings are where you set the rest of the attribute site configuration options.

I think its:
Site Administration -> Configuration -> Attributes

but I could be wrong. I'll poke around with my install later.

I believe the error the plugin generates in watchdog should tell you specifically what is not set, but I don't think it tells you where to set it. That might be a good idea as well.

I definitely appreciate any testing you can do with the plugin to find any bugs. Working on this plugin is not part of my day job, so I don't have a lot of time to test. What you found with Chrome, Opera, and Safari is very helpful. If there is any additional functionality you'd like to see as well, please feel free to let me know.

I'm relatively new to Drupal, but as far as the hard coded value of the size is concerned, why don't you just update the CSS file to override the size? I would think there should be a CSS file associated with your theme, but I haven't yet worked with Drupal's theme system to know for sure.

CSS values set will always take precedence over anything directly in the HTML. I've used that technique in other projects on other applications to avoid having to change the PHP code.

tembenite's picture
Offline
Joined: 08/15/2010
Juice: 64
Re: Randy, Yeah, I didn't

Oh, I should also mention that this latest version implements permissions, however not all of them have been implemented yet.

As a result to view a file requires "view file" permission explicitly set. Giving someone "view all files" permission without giving them "view file" permission will not allow them to view a file, even though by the naming it sounds like it should. (This will be fixed when this if fully implemented)

Giving someone "view all files" permission will allow them to see any uploaded files as part of an order as long as they have "view file" permission as well. Without "view all files" permission you can only see files associated with your orders. Anonymous user orders are prompted for their billing zip code before being allowed to see the file.

There is no way for anyone but the person who uploaded the file to access files uploaded to their cart. I figured there was no practical reason to allow this, and preventing this access should keep someone from trying to user your site to upload malware documents and try to link/trick people to go to them.

julio575's picture
Offline
Joined: 09/16/2010
Juice: 5
Hello Doug, I am very

Hello Doug,

I am very interested on any updates or testing you might need help with, please keep me informed. I am really new to Drupal and Ubercart but will do my part to help out. I really need something like to so I can build my website.

Thank you,

Julio

tembenite's picture
Offline
Joined: 08/15/2010
Juice: 64
Julio, My post

Julio,
My post from:

Submitted on Wed, 09/15/2010 - 19:33

Has a link to the latest Beta if you want to download and test.

The build is only for the Drupal 6.x release, so if you're running another release I do not have a version for it yet.

You should be able to extract the module anywhere you can install Drupal modules, and then enable it within Drupal.

I personally have it sitting under:
modules\ubercart\

Once you've done that, let me know how it goes. If you encounter any problems, I might have to upload a version of the code to help troubleshoot, or give you a modification to one of the files to give me more output of what is going on.

The plugin also logs the reasons for quite a few errors to watchdog, while displaying a generic error to the user.

Thanks,
Doug

julio575's picture
Offline
Joined: 09/16/2010
Juice: 5
Re: [Almost Complete] - Handling upload of file as an attribute

I got the following error

AttachmentSize
asa.jpg 58.4 KB
tembenite's picture
Offline
Joined: 08/15/2010
Juice: 64
Re: Re: [Almost Complete] - Handling upload of file as an attrib

Those errors don't reference my plugin, or files that are within my plugin.

I suggest you disable tcsprint, whatever that is, and enable my module which is uc_attribute_files.

wimb's picture
Offline
Joined: 09/18/2010
Juice: 14
great work

Can't believe something like this hasn't been developed before you.

I have installed your module, but don't have the option for file upoad in the attributes window. Checkbox, radio, etc, but no file upload. From what I know about databases, I believe I correctly changed the display value to 4. The window in the product is showing up, but no ability to upload anything.

Just for future thinking, what about the possibility to have the file upload be verified against size specifications?

Please let me know how I can help you finish up this much needed piece to Ubercart.

tembenite's picture
Offline
Joined: 08/15/2010
Juice: 64
Thanks. I have the bug fixed

Thanks.

I have the bug fixed which affects the "File Upload" not appearing on the attributes page drop-down. I'm working on a few other things before I post another code update. One of the things I'm putting in is a little bit more error logging. I think I'm also going to change it so that if a variable is not set in the config, and the user is logged in as the admin userid it gives a non-generic message.

You want the end-user to have a generic message, but there is no reason an Admin should not see an error message.

I am also very surprised this functionality is not in the core code. You can see the forums filled with people requesting this functionality. A few of the people I talked with indicated that they wrote something, but I guess no one so far has wanted to share. I've used so much open source code all the time, I just figured it was about time to give back and write something.

As far as not being able to upload anything, an error as to why might have been written to Watchdog. You can view this log by going to:

admin/reports/dblog

If you haven't sent the default upload paths under:
admin/store/settings/attributes

That would be the most likely reason why a new setup wouldn't work yet.

Otherwise if you wait until this next update I should have more logging added in to further narrow what is going on.

tembenite's picture
Offline
Joined: 08/15/2010
Juice: 64
Re: Thanks. I have the bug fixed

Ok, here is the latest version:
http://www.dlogan.net/drupal/uc_attribute_files_Beta_0.65.tar.gz

I have not had a lot of time to test these updates, but:

Changes:
* File Upload should now properly show when editing an attribute under a product.
* Error messages now display to admin user when attempting to download a file.
* Permissions now work properly so you can give someone just "view all uploads" access to see all.
* Better error messages added to Watchdog for a number of errors.

NOTE: I had no display issues in Chrome. I have not had a chance to try in Opera. Has anyone else been experiencing the problem described where the File Upload boxes are showing as text boxes in browsers other than IE or Firefox?

Todo:
* Fix http://localhost/drupal/?q=node/6/edit/options so notes on the way options are used with the "File" type
* Adjust the price of items in the cart based on the extension of the option chosen
* Track down why getting "Invalid type of order was passed by user" within Watchdog
* Add more Watchdog/Admin messages on uploading a file
* Organize code into logical sections and write a header for what each function does.
* Separate Admin functions for an admin include.

wimb's picture
Offline
Joined: 09/18/2010
Juice: 14
totally stoked

cant wait to give this a try. i'll let you know more...

wimb's picture
Offline
Joined: 09/18/2010
Juice: 14
oh snap!

positive results so far. i'm so excited!!!

johngflower's picture
Offline
Joined: 01/04/2009
Juice: 88
File uploads in Ubercart, YAYYYY!

This is a feature I've wanted for over a year now. I'll try it out later on.

Gary Pryde's picture
Offline
Joined: 01/21/2011
Juice: 4
File Upload Option 4 Ubercart Attributes or uc_attributes_files

I searched under a few terms I wanted to list them so others using those terms might find there way here. Excellent job! I have to admit I was a bit nervous due to the code was not part of Drupal.org.

Terms:
Ubercart Attributes Option Image
Ubercart Attributes Option file upload
Ubercart Attributes Option image upload
Ubercart Attributes Option Sub Product Image
Ubercart Attributes Option create upload file field
Ubercart Attributes Option file attachment
Ubercart Attributes Option add extra file fields to products
Ubercart Attributes Option add image upload option

I tried a few more but hopefully these will bring some folks to this link: http://www.dlogan.net/drupal/uc_attribute_files_Beta_0.65.tar.gz

Everything works well. Need to have the right theme though. Didn't work with my theme and had to switch to another one. (Artisteer generated theme didn't work).

Many thanks for your work dlogan. Also much thanks to tembenite for sharing the re: from dlogan.net

Best Regards!

wrmhle's picture
Offline
Joined: 08/09/2012
Juice: 8
export from artisteer to ubercart

From version 4.0, Artisteer supports Export Plug-ins (http://www.artisteer.com/?p=dev) and you can create your own plugin for export for Ubercart

Bob

rhill's picture
Offline
Joined: 09/09/2010
Juice: 15
Testing update

Hello Doug,

Looks great!

I was able to find something very interesting about a theme/browser combination that may cause the Image Upload not to display.

Here are my findings so far with the Analytic theme:

IE8, FireFox 3.6.10 - Works (source)

<div class="attribute attribute-17 even"><div class="form-item" id="edit-attributes-17-wrapper">
<label for="edit-attributes-17">Image Upload: <span class="form-required" title="This field is required.">*</span></label>
<input type="file" name="files[Image Upload]"  class="form-file required" id="edit-attributes-17" size="60" />
</div>

Chrome 6.0.472.62, Opera 10.62, Safari 4.0.5 - Does Not Work (source)
<div class="attribute attribute-17 even"><input type="hidden" name="attributes[17]" id="edit-attributes-17" value=""  /></div>

Hope this helps,
Randy

rhill's picture
Offline
Joined: 09/09/2010
Juice: 15
Directory

Hey Doug,

One more thing where does it upload the images, because I keep getting this error "Upload to directory failed. Please contact an administrator."

Thanks,
Randy

100IT's picture
Offline
Joined: 02/14/2010
Juice: 19
file upload for ubercart

I've made a module which has this functionality. It's based on what I learned figuring out the attributes module.

Its still in alpha but a working example can be found here http://www.robinick.be

The product form has an extra collapsible upload field which can be used to add an upload to the cart.

It's not ready for the wide audience since its not documented + a few minor bugs.

Example is in dutch but would be understandable I think.

Radio buttons colour and extra quality field could be adjusted but only programmatically for now.

Send me a message for sources or collaboration in this project.

Regards.
Chris

http://www.100it.be

tembenite's picture
Offline
Joined: 08/15/2010
Juice: 64
Re: file upload for ubercart

Sounds interesting! We definitely should work on merging the sources and having an officially published plugin.

tammo's picture
Offline
Joined: 08/22/2010
Juice: 18
Very much interested....

I am looking for exact this functionality. Did you manage to take the step of removing the bugs? I could very well use this on the website of the Dopper: http://www.dedopper.nl

If I could use your sources that would be great!

tammo's picture
Offline
Joined: 08/22/2010
Juice: 18
Very much interested....

I am looking for exact this functionality. Did you manage to take the step of removing the bugs? I could very well use this on the website of the Dopper: http://www.dedopper.nl

If I could use your sources that would be great!

bearstar's picture
Offline
Joined: 05/08/2009
Juice: 50
I would like to give it a try

Hi Chris,
Would it be possible to send me the module files? I would like to deploy it and test it out on a test site.
Thanks,
James

tembenite's picture
Offline
Joined: 08/15/2010
Juice: 64
Randy, You need to go

Randy,
You need to go to:

Store Administration -> Configuration -> Attributes

There are a few other parameters added there which define the folder used for uploading items for a cart, and a folder where things from orders gets put.

Thanks,
Doug

rhill's picture
Offline
Joined: 09/09/2010
Juice: 15
More info

Hi Doug,

I got the directory path configured, but every time I upload an image something creates a subdirectory "1" and puts the image there.

my path is: sites/default/files/ul

after upolad the image is in: sites/default/files/ul/1

And does not display in the shopping cart.

Thanks,
Randy

wimb's picture
Offline
Joined: 09/18/2010
Juice: 14
Ahh!

Hey Doug-

I guess I am a little bit lost. I keep getting this message when I click on the link to view my uploaded file.

Fatal error: Cannot access empty property in /home/content/a/d/i/adi27800373/html/v1/sites/all/modules/uc_attribute_files_Beta_0.65/uc_attribute_files.module on line 127

the files are not being uploaded or saved. i have the attributes filed out at store administration - configuration - attributes

i believe all the permissions are set correctly. they are view uploads and view all uploads for anonymous and authenticated users

what else haven't i done? thank you

tembenite's picture
Offline
Joined: 08/15/2010
Juice: 64
Re: Ahh!

Do you have any additional errors within your system log database ("Watchdog")?

The version you're running should output quite a bit into the logs indicating where it is and what's causing problems when its not working.

I can also take a look at what is at line 127 sometime tonight. I do not have the code in front of me right now.

Thanks,
Doug

wimb's picture
Offline
Joined: 09/18/2010
Juice: 14
nothing there.

i don't see anything in the logs.

dtesenair's picture
Offline
Joined: 08/02/2009
Juice: 8
Elegant solution

Nice work on this. I've read many threads with people looking for similar functionality. I ended up using the Node Checkout module (uc_node_checkout) to accomplish a similar end. However, I really like the idea of image uploads as an attribute, like you've done.

In my case, we need to be able to upload multiple images for a single product and allow the user to preview the file. I originally thought about writing a module that would integrate with CCK Filefield and Imagefield modules but am not very well versed in PHP & Drupal modules. What are your thoughts on this approach?

My customer's site... http://www.canvasdepot.com/catalog

Thanks and great work!
Dan

twm
twm's picture
Offline
Joined: 11/22/2010
Juice: 8
Re: [Almost Complete] - Handling upload of file as an attribute

The user receives the following error when attempting to upload an image:

An illegal choice has been detected. Please contact the site administrator.

This is the only error in watchdog:

Illegal choice [UC_ATTRIBUTE_FILES]filename.jpg[/UC_ATTRIBUTE_FILES] in Image element.

This is a fresh install of Drupal 6.19 with Ubercart 6.x-2.4 and no other modules installed.

I would love to get your module working. I will try it on another server to see if a server configuration is causing this problem.

sevenoclockshadow's picture
Offline
Joined: 08/20/2009
Juice: 12
twm wrote:The user receives
twm wrote:

The user receives the following error when attempting to upload an image:

An illegal choice has been detected. Please contact the site administrator.

This is the only error in watchdog:

Illegal choice [UC_ATTRIBUTE_FILES]filename.jpg[/UC_ATTRIBUTE_FILES] in Image element.

This is a fresh install of Drupal 6.19 with Ubercart 6.x-2.4 and no other modules installed.

I would love to get your module working. I will try it on another server to see if a server configuration is causing this problem.

-edit-

Just figured this out:

edit the product, then go into options and deselect the option for the file upload.

bellagio's picture
Offline
Joined: 12/09/2010
Juice: 51
Re: [Almost Complete] - Handling upload of file as an attribute

I installed uc_attribute_files_Beta_0.65.tar.gz /drupal 6.19, and have the following error.
1. When attribute is added to product
2. When click on the uploaded file name to view in cart page.
(screenshot attached)

Any help would be great. Thank you.

AttachmentSize
error_1.png 12.19 KB
error_2.png 18.14 KB
bellagio's picture
Offline
Joined: 12/09/2010
Juice: 51
Re: Re: [Almost Complete] - Handling upload of file as an attrib

It turns out error 1 occurs when my custom module to alter add to cart form was enabled.
Error 2 is fixed by changing line 127 to $uid == $user->uid. just delete $ from $uid.

donatello's picture
Offline
Joined: 05/02/2010
Juice: 18
hi, i want to integrate your

hi,
i want to integrate your module with jquery multiple file uploads:
http://www.fyneworks.com/jquery/multiple-file-upload/

Coule you tell me what part of the code i should look ad if i want to make you module handle multiple files?
If i manage to male it work, i'd be glad to post it here.

Thanks a lot

tembenite's picture
Offline
Joined: 08/15/2010
Juice: 64
Re: hi, i want to integrate your

I got side-tracked on another project and I'm not actively working on this right now. When I get back into the code, I'd be glad to review it.

However, my first thought is that it would not be simple to use the "multiple file upload" with these modifications and there is not just "one section of code" to change to get it to work.

tchurch's picture
Offline
Joined: 05/27/2009
Juice: 36
subscribing. Very interested

subscribing.
Very interested in this.

csdesignco's picture
Offline
Joined: 02/10/2010
Juice: 230
Re: subscribing. Very interested

Found an error on line 389 of uc_attribute_files.module. If you do not have any existing attributes for a product, an error is thrown: warning: Invalid argument supplied for foreach() in ~/sites/all/modules/uc_attribute_files/uc_attribute_files.module on line 389

A simple workaround is to ammend that line as follows. Before:

<?php
     
case 'uc_object_attributes_form':
          foreach(
$form['attributes'] as $id=>$attribute){
           
$form['attributes'][$id]['display']['#options'][variable_get('uc_attribute_files_attribute_number', 4)]    = t('File Upload');
          }
        break;
?>

After:

<?php
     
case 'uc_object_attributes_form':
          if (isset(
$form['attributes'])) {
            foreach(
$form['attributes'] as $id=>$attribute){
             
$form['attributes'][$id]['display']['#options'][variable_get('uc_attribute_files_attribute_number', 4)]    = t('File Upload');
            }
          }
        break;
?>