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
yurevichcv opened this Issue Mar 5, 2016 · 9 comments

Comments

Projects
None yet
3 participants
@yurevichcv
Contributor

yurevichcv 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.

@yurevichcv

This comment has been minimized.

Show comment
Hide comment
@yurevichcv

yurevichcv Mar 5, 2016

Contributor

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

Contributor

yurevichcv commented Mar 5, 2016

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

@akrabat

This comment has been minimized.

Show comment
Hide comment
@akrabat

akrabat Mar 5, 2016

Member

oh, good catch!

Member

akrabat commented Mar 5, 2016

oh, good catch!

@akrabat

This comment has been minimized.

Show comment
Hide comment
@akrabat

akrabat Mar 5, 2016

Member

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

Member

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?

@yurevichcv

This comment has been minimized.

Show comment
Hide comment
@yurevichcv

yurevichcv Mar 5, 2016

Contributor

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).

Contributor

yurevichcv 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).

@yurevichcv

This comment has been minimized.

Show comment
Hide comment
@yurevichcv

yurevichcv Mar 5, 2016

Contributor

Previously I used it this way:

<?php

use League\Csv\Reader;

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

yurevichcv 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

@akrabat

This comment has been minimized.

Show comment
Hide comment
@akrabat

akrabat Mar 5, 2016

Member

Fixed and 3.2.2 is now released.

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

Member

akrabat commented Mar 5, 2016

Fixed and 3.2.2 is now released.

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

@yurevichcv

This comment has been minimized.

Show comment
Hide comment
@yurevichcv

yurevichcv Mar 5, 2016

Contributor

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

Contributor

yurevichcv commented Mar 5, 2016

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

@akrabat

This comment has been minimized.

Show comment
Hide comment
@akrabat

akrabat Mar 5, 2016

Member

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

Member

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

This comment has been minimized.

Show comment
Hide comment
@merumelu

merumelu 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.

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