PHP-FileUpload
PHP-FileUpload copied to clipboard
Add method 'getSourceInputName' to class 'FileUpload'
That method adds possibility of retrieving the original file name that is going to be uploaded
Thank you very much!
Do you have any specific use cases in mind? I guess you want to use this piece of information in order to present it to the user in some way, or to distinguish or organize files, not for the internal storage location (because that is handled automatically), right?
And do you think it would be sufficient to store and return the base name of the file (without the extension)? That’s because we handle extensions automatically and we already know the new extension that the file is actually being stored with on the server.
@ocram Yes, I suggest using the original file name NOT to store, just to provide information. For example, on one of the projects where I use this library, I need to store the parameters of the files in the database (the same system is used in WordPress to store media files).
Suppose I want to create a new blog entry, for this I upload a picture to the site and I want to insert it into the blog entry, but in order to find this picture in the site's file browser, I have to search through thumbnails. If I had the original file name stored in the database, I could simply use the search by name to find the desired image.
P.S. I think that providing a full original name (with file extension) will be a better solution, because I can have simmilar files like picture.jpg and picture.png with different content
Thanks!
If you only want to find uploaded images more easily, storing timestamps or optional labels that the user can enter in addition may work as alternatives.
Anyway, we will add access to the original filename (both with and without extension) soon.