Rui Song Chong
Posts: 0
Joined: Sat Jan 17, 2015 10:51 am

Upload file, without log in

Hi,

Tried your code and nothing appear. However, I tried this code instead and the file name is return as undefined.
"alert("Your file was successfully uploaded, file name: "+data.filename);"

Image

Image

Rui Song Chong
Posts: 0
Joined: Sat Jan 17, 2015 10:51 am

Upload file, without log in

Hi,

For now, can I Just know how can I get the file name I uploaded?

Rui Song Chong
Posts: 0
Joined: Sat Jan 17, 2015 10:51 am

Upload file, without log in

My question now is that how can I let the user to upload information which will create a new row including an image into the database.

Image

Image

For uploading images, I followed this tutorial online, http://devcenter.appery.io/tutorials/...

So right now, I'm trying Mr Yurii Orishchuk suggested method, but I am stuck at step 2, on how to get the file name of the image I just uploaded. I know it's something to do with the success event handler, but I don't know exactly how.
Is there a specific and clear way on how can I get the file name of the image I just uploaded?

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

Upload file, without log in

Hi Rui,

Here is a code to get all uploaded files:

pre

for(var i = 0; i < data&#46;length; i++){
&#47;&#47;here you can use "data&#46;success&#46;filename" as you need&#46;
alert("filename[" + i + "] = " + data&#46;success&#46;filename);
};

/pre

Details: http://prntscr.com/639pup/direct

Regards.

Rui Song Chong
Posts: 0
Joined: Sat Jan 17, 2015 10:51 am

Upload file, without log in

HI,

Thanks for your response, I managed to store the filename in local storage. I also tried the steps you suggested earlier on, link the filename from my local storage to "servce request" on create_service, however the database still doesn't appear the new row.

This is what I did.
I have create_service, to upload new information to the table, and I have upload_service to upload image to the file collection. on the upload_service, I first run the javascript to store the filename into the local storage, then I invoke the create_service on success, which link all the input including the uploaded image to the "service request"

I have tried to invoke the create_service alone without uploading image, and it works, and I have also tested the local storage, which I'm sure the filename was successfully pass into it. I think now the problem is the linking part from local storage filename to the service. Can you tell what's wrong in the process? Thanks!

Image

Image

Rui Song Chong
Posts: 0
Joined: Sat Jan 17, 2015 10:51 am

Upload file, without log in

This is what I have been trying to do,

When the user click upload, a new row should be created in the table, with the input of new information and image. Is my logic of linking the new image to the new row in the table correct? or is there any other better way?

Image
Image

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

Upload file, without log in

Hi Rui,

Your service mapping looks okay,

Please open network tab of the browser debugger and find this "create" service response. Then check if you passed correctly "fileName" there. Also please show us this screen shot.

May be this topic could be helpful: https://getsatisfaction.com/apperyio/...

Regards.

Return to “Issues”