PHP-FileUpload icon indicating copy to clipboard operation
PHP-FileUpload copied to clipboard

Add method 'getSourceInputName' to class 'FileUpload'

Open Oihso opened this issue 6 years ago • 3 comments
trafficstars

That method adds possibility of retrieving the original file name that is going to be uploaded

Oihso avatar May 24 '19 18:05 Oihso

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 avatar May 29 '19 22:05 ocram

@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

Oihso avatar May 29 '19 23:05 Oihso

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.

ocram avatar Jun 02 '19 22:06 ocram