Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slim\Http\UploadedFile - no way to retrieve client-provided full path to the file #1798

Closed
ConstantineYurevich opened this issue Mar 5, 2016 · 9 comments

Comments

@ConstantineYurevich
Copy link
Contributor

@ConstantineYurevich ConstantineYurevich commented Mar 5, 2016

Previously it was at least possible to use public variable $this->file.

Now there is not way to retrieve full path at all.

@ConstantineYurevich
Copy link
Contributor Author

@ConstantineYurevich ConstantineYurevich commented Mar 5, 2016

If $this->file was removed from public access, you should add some getter, I guess.

@akrabat
Copy link
Member

@akrabat akrabat commented Mar 5, 2016

oh, good catch!

@akrabat
Copy link
Member

@akrabat akrabat commented Mar 5, 2016

I'm not sure that this property should be public in the next version though. What's the use-case for needing it?

@ConstantineYurevich
Copy link
Contributor Author

@ConstantineYurevich ConstantineYurevich commented Mar 5, 2016

My particular example is importing CSV file using http://csv.thephpleague.com/examples/ library (one of the most popular libraries for working with files).

I want to import CSV data without uploading file to S3 (I'm using stateless container-based architecture) using following code:

<?php

use League\Csv\Reader;

$csv = Reader::createFromPath($uploadedFile->getClientFileTmpName());

Where path should be tmp_path from UploadedFile object (which is not available now).

@ConstantineYurevich
Copy link
Contributor Author

@ConstantineYurevich ConstantineYurevich commented Mar 5, 2016

Previously I used it this way:

<?php

use League\Csv\Reader;

$csv = Reader::createFromPath($uploadedFile->file);
@akrabat akrabat closed this in #1799 Mar 5, 2016
akrabat added a commit that referenced this issue Mar 5, 2016
Closes #1799
Closes #1798
@akrabat
Copy link
Member

@akrabat akrabat commented Mar 5, 2016

Fixed and 3.2.2 is now released.

I'm sorry for the inconvenience that this caused you.

@ConstantineYurevich
Copy link
Contributor Author

@ConstantineYurevich ConstantineYurevich commented Mar 5, 2016

Maybe it makes sense to create getter for this field, and make usage of public property deprecated?

@akrabat
Copy link
Member

@akrabat akrabat commented Mar 5, 2016

Probably. We need to look at it, but I didn't want to slow down the release of 3.2.2.

@merumelu
Copy link

@merumelu merumelu commented Mar 5, 2016

It is possible to get the temp path with $uploadedFile->getStream()->getMetadata('uri'), but this is rather verbose. A simple getter would be nice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.