#1
#2
Can you post your code for file upload.

Dan
#3


After the call to upload_file, how do you get the new_file_name?
#4
Hi Frocco

Assign a variable to the upload_file method and then use the json method to view what is returned.
Then you'll see how to view the new filename.

#5
thanks for the suggestion, just tried it and it returns null
#6
Yes, I tested and you are right and I believe I ran into the same issue before.

In the upload_file method in Trongate.php it doesn't return anything.

So you could add return $new_file_name; but it will be overwritten later on future updates.

Perhaps try copying that method into your controller file and then add the return $new_file_name; at the end.

#7
Correct, I ended up doing as you suggested and copied the upload function to my controller and returning the file name.
Problem solved, but I think Trongate.php needs to be enhanced.
#8
When you upload a file, in PHP, you create a $_FILES superglobal.

You can view this by going to your submit endpoint and adding:



This will give you a summary of some key information to do with your uploaded file. For example,



So, the code for getting the file name is:



WEAKNESSES & POSSIBLE IMPROVEMENTS

I think there are a couple of improvements that could be made with the system we have. Specifically,

* Clean the filename to remove potentially problematic characters like spaces.

* Return the filename after the upload has happened.


We have a wave of framework updates coming very soon (all non-breaking changes). I'll try my best to add those tweaks shortly.
#9
Thanks Dave, looking forward to them.
#10
Cheers dude.