brandonsavage / Upload

File uploads with validation and storage strategies
MIT License
1.67k stars 315 forks source link

undefined method getMd5 #33

Closed verglas closed 10 years ago

verglas commented 10 years ago

Call to undefined method Upload\File::getMd5()

scottrobertson commented 10 years ago

Can you give a bit of context as to how you are calling this etc please

merolhack commented 10 years ago

// Access data about the file that has been uploaded $data = array( 'name' => $file->getNameWithExtension(), 'extension' => $file->getExtension(), 'mime' => $file->getMimetype(), 'size' => $file->getSize(), 'md5' => $file->getMd5(), 'dimensions' => $file->getDimensions() );

scottrobertson commented 10 years ago

Ah this may be related to #40 - is this being called after the upload has finished?

merolhack commented 10 years ago

In the Usage docs https://github.com/codeguy/Upload is before the upload, after create the instance of $file

scottrobertson commented 10 years ago

Yeah - what i mean is, in your code are you calling it in the same place?

merolhack commented 10 years ago

Yes, i installed upload with composer, and in the class "\vendor\codeguy\upload\src\Upload\File.php" the methods: getMd5() and getDimensions() are not present.

codeguy commented 10 years ago

@merolhack Can you post the specific commit pulled down via Composer?

scottrobertson commented 10 years ago

@codeguy he is correct, they are not in master....

Edit: Ahh i see, you have moved it to FileInfo.php. I did not see that update, docs must just be incorrect maybe?

merolhack commented 10 years ago

In composer install: "require": { "php": ">= 5.3.0", "codeguy/upload": "*" },

codeguy commented 10 years ago

@merolhack For now, pull down the latest tagged release with "codeguy/upload": "1.*".

codeguy commented 10 years ago

Mistakenly pushed some new changes to master (untagged). You should be safe pulling down 1.3.1 or 1.3.2. I'll wrap up the new changes tonight and tag a new release with updated docs.

merolhack commented 10 years ago

It Works now!! :+1: $ composer update Loading composer repositories with package information Updating dependencies (including require-dev)

scottrobertson commented 10 years ago

@codeguy is this the same issue as #40 then?

codeguy commented 10 years ago

@scottrobertson Yes

scottrobertson commented 10 years ago

@codeguy Ok. Let me know if i can be of any help later on.

codeguy commented 10 years ago

The changes I made will automatically handle file uploads as an array. Those methods were moved to the new FileInfo class, but I can add them back to the primary File class and return a scalar or array value based on how many FileInfo objects are present.

scottrobertson commented 10 years ago

Yeah, that sounds good to me. It would be good to keep any of them methods (getMd5 etc) out of File if possible.