When using a Wix upload button, I need the full path name to the uploaded file in order to transfer it to AWS S3. Can you help me?

I have had a few conversations with wix support on the issue and have gotten nowhere. My only other two options after this are to request a new added feature (which means including a new attribute for the upload button: the path name that the user selected the file from) or to find another way to select a file within my wix web site. Short of this, I can only give up wix, because without being able to upload a file to AWS S3, my site is useless. The following is some of the discussions between me and Wix Support over the last few weeks:

Daniel (Wix Support)

April 15, 2019 8:25 AM (UTC-04:00)

Hello, and thank you for your patience.
I understand that you wish to receive an immediate answer with respect to the issue and that you have not necessarily found the answer your are seeking in the Wix Corvid Forum . As previously mentioned, however, the solution you seek requires coding. While we support Wix Code features and components here in the Support center, we are unable to provide support for custom coding which is necessary to achieve the functionality in question. Wix provides various tutorials and instructions for using Wix Code, but as Wix Code is an advanced feature and a dynamic product, Wix can only provide templates for coding features (as is the case here), but not provide the specific custom code necessary for individual sites.
Please be aware the the Wix Corvid Forum is a community driven network in which other developers and code beginners seek out assistance to address their respective needs. As such, we are not able to provide a specific time frame for when an answer may be provided.
In reviewing the forum, I did find a post that may be relevant to your needs. You can review the post here . You also may be interested in the posts here and here.
Please also keep in mind that when posting in the forum to follow the guidelines outlined here . Following these guidelines can encourage other users to reply to your thread as the more information provided that describes the specific issue, the easier it is for the forum community to assist.
Sincerely,
Daniel
Wix Customer Solutions Expert

Conversation history

Artpuryear3

April 12, 2019 8:34 AM (UTC-04:00)

Thank you for responding to my question, but I think I need to ask the question in a different way. First, my experience with the Wix Code forum is not good. I have asked somewhere around a dozen questions over the last year in the forum and I have gotten zero answers which were useful to me. I am reluctant to try that path again so as not to waste my time.
Second, there are two people who work at Wix who can answer my question. The first is the person who wrote the code for the upload button. They would know what information from the user selection was kept(i.e. the path name used to find the file) and what information wasn’t. The second is the person who developed the AWS SDK app which I installed from the Wix app store. This person took all of the trouble of developing an app for the AWS SDK and I can’t believe that they released this app to the public without testing it. If they did test it, but they used hardcoded file names, that’s fine, but I would like to ask them to select the file using a file upload button in Wix and see if they can store something in AWS. Because AWS expects the full path name and without it you are unable to store anything in AWS which make the AWS SDK useless if you can’t store anything in AWS. It would be just phantom code, it doesn’t do anything.
I know I am asking a lot for you to talk to people who work at the same company as you do, but it seems that they are the only ones who have the information that I need and or can make any changes which would be needed to correct the behavior of wix. All I want is to store a file in AWS and all I need to do that Is the full path name of where that file is located (this information appears in the dialog that the user uses to select the file, so I know its available, I just need it to be stored as one of the attributes for the upload button, where I could display it in a field on the web page (no code) or use it in code such as in an AWS SDK call). If there is any way possible that you could get me the information that I need, I would be very appreciative.
Thank You.
From: Wix Support
Sent: Thursday, April 11, 2019 11:46 AM
To: artpuryear@gmail.com
Subject: Your ticket: Need the path name for a file uploaded by the uploadbutton on my web page has been answered

Reynaldo (Wix Support)

April 11, 2019 2:46 PM (UTC-04:00)

Good day.
Thank you for contacting Wix Technical Support.
We understand that you wish to retrieve the file directory from where users upload their contact from, i.e. C:\Users\Broly\Pictures\GettingCut.jpg . Please post that question within the forum to hear what the community as has to offer. We have a dedicated team of select Wix developers and employees that monitor our Wix Code Forum. As the design of our forum for Wix Code is a community discussion, we encourage members to explore the various posts that exist there to find answers to your inquiries. While we support Wix Code features and components here in the Support center, we are unable to provide support for custom coding.
For your needs, we highly recommend using the Wix Code Forum . The Forum is a community where developers and other Wix users engage in common questions and issues.
Feel free to contact us again if you need any further assistance.
Have a good day.
Reynaldo
Wix Support Specialist

Rotem (Wix Support)

April 11, 2019 3:54 AM (UTC-04:00)

Hi,
Thank you for contacting us.
Your query has been forwarded to the relevant department. They will investigate this matter further and get back to you as soon as possible with more information.
We apologize for the inconvenience and thank you for your patience.
Kind regards,
Rotem
Wix Customer Solutions Expert

Artpuryear3

April 10, 2019 9:33 AM (UTC-04:00)

Sorry, but I am not looking for the URL, but the windows file name. When the user selects the file to be uploaded, they go through the directory structure in the windows file system and come up with something like C:\myfiles\thefile.txt. I need to pass C:\myfiles\thefile.txt to AWS in order to store that file in S3. It won’t take a URL only a file name with the complete path. This is available in the dialog used to select the file, how can I get it?
From: Wix Support
Sent: Wednesday, April 10, 2019 6:10 AM
To: artpuryear@gmail.com
Subject: Wix: Your ticket: Need the path name for a file uploaded by theupload button on my web page has been answered

Will try to help you out. Could you clarify some things for me:

  1. do you save a file using startUpload or with .save() from the dataset?
  2. do you need the file name instantly after uploading or
  3. do you need it later on, during a postponed action (like a cron job or Wix Job)?

I am needing the file name immediately after the user selects if from the directory structure on their computer, laptop, tablet, or mobile device. I want to store it in AWS first. At some point later, per user action, I want to upload it to WIX and present the file to the user.

You have not answered question 1. It´s important to know.

I will use the startUpload call later when the user wants to review the file. This however could be seconds, minutes, hours or days after the user made the selection of which file they are selecting and I have uploaded that file to AWS. Are you saying something like, I have to upload the file and store it in WIX before I can see the path name that the user selected the file from? This is just a little confusing as this information is available in the file selection dialog before the file needs to be saved, it is in the dialog box that the user uses to select the file. Could you please explain to me why this specific sequence of events is necessary and not the way that I want to do it?

I think I start to understand what you mean. If you use the file upload button, then there are 2 moments that you can access the filename:
1)once the user has picked a file. In this case, the file(s)to upload are stored in the value property, so you can access them (note, this is BEFORE uploading to Wix)
2) after .startUpload. It returns a Promise, with the name and path Wix has now stored the file(s)

Would option 1 work for you?

Option 1 would be what I am looking for. I didn’t know that this information was kept in the value property, but I will try to find it there. What I don’t know is the format of the value property, i.e. what fields are contained in it and which one contains the original file name. Perhaps you could point me to an example of someone using the value property at this point so I can see how it is used?

Well, it seems like we have come full circle. What I see from your example is the code that I have already written.

let theVideoFilenames=$w(‘#uploadButton1’).value;
let theVideoFilename=theVideoFilenames[0].name;
let thevideoFilePath=theVideoFilenames[0].path;

The last line of code is something that I have written, but doesn’t work because there is no path attribute as part of the value field. I was hoping you could show me an example which told me which attribute I could use to get the path name for the file. Let me explain again why I need this information:

When the user selects a file using the file upload button on my web site, the following dialog box appears on my PC (I’m sure its similar for an apple, tablet, iphone, or android).

I started by clicking on the Windows (C) on the left side of this dialog so my FULL PATH NAME at this point was C: . I next viewed the area under C: and selected MyDir1 so the FULL PATH NAME was now C:\MyDir1 . I continued on until I found the file that I wanted and at this point my FULL PATH NAME was C:\MyDir1\MySubDir1\MySubSubDir1\FileToUpload.txt . Note that in the picture above, the box in the dialog which is titled File name: is FileToUpload.txt and at the top of the screen is the path name that gets you to this file (both are available on this screen). When I click the Open Button, the dialog disappears and the screen that brought up the dialog changes to:


This shows the file name under the file upload button as FileToUpload.txt, but where is the rest of the path name. This name FileToUpload.txt is what is given to me when I reference theVideoFilenames[0].name. Now I want to upload this file to AWS by calling the AWS Function s3.upload-file which expects the file name that you want to upload and the FULL PATH NAME on your device where that file is located. This means that AWS expects the name C:\MyDir1\MySubDir1\MySubSubDir1\FileToUpload.txt as a parameter or else it doesn’t know what it is that I want to upload. Unfortunately, after the user makes a file selection, the only thing available to me is FileToUpload.txt, unless the rest of the path name is available as an attribute in the file upload button. If it is available, I need to know how to find it. If it isn’t available, even though it was present in the file selection dialog, then I need to make a change request of WIX to add a new attribute to the file upload button. Is there anyway that you can help me find out which option I need to take.

In addition to this, later on when the user clicks on the VIEW VIDEO button on my web page, I download the file from AWS, and now I want to set a WIX file upload button to point the file that I now have so that I can upload it to WIX. How do I tell it that $w(’ #uploadButton1 ').value[0].name can be set to the file that I just dowloaded from AWS. Don’t I need to alllocate space via new in order to do that or is there some other way?

I fully understand your problem now. I dug a little bit deeper into your problem and investgated the standard fielUpload in plain HTML. In w3schools it states that a path is not given, but a fake substitute is : HTML DOM Input FileUpload value Property
On Stackoverflow I found this: " The answer to that question is “you can’t”, because modern browser will not tell you the path on the client, for security reasons ", see: asp.net - Get full path of a file with FileUpload Control - Stack Overflow

In short: a Wix change request will not do you any good, because the browser prevents you from getting it in the first place.

So as far as I can tell, there is only 1 way out: first upload it to Wix, then copy (stream) it to AWS. Wix will give you a wix file name starting with “wix:”. A long time ago I put some code here (first contributed by Andreas, but it no longer worked) on this forum that filters a normal, valid URL from that. If you can´t find it, let me know, I still have source code.

Hope this helps.

EDIT: after I wrote this, I realized another problem: I think Wix does not allow you to upload videos, just the URL to a Vimeo or Youtube file. I remember some info on this when this possibility was added, in the New Feautures part of this forum, maybe a year ago or so. If this is true, you have a big problem.