News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

[FIXED] Cannot upload images + mimetype error + slug error

Started by Razva, October 03, 2011, 15:55:32 PM

Previous topic - Next topic

Milbo

hello constantined,

yes your fix is correct, thanks. Why we dont use Git? quite simpel answer, because I am happy, that the people started to learn svn. Git will follow.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

constantined

#16
Not fixed. The while loop will never start.
Quote
$mediaPure = JFile::stripExt($media['name']).'-';
$mediaExtension = JFile::getExt($media['name']); // we need ".jpg", not "jpg"

while (file_exists(JPATH_ROOT.DS.$path_folder.$mediaPure.$mediaExtension)) { // at start it checks "image-jpg" file and doesn't enter loop
   $media['name'] = $this->file_name = $mediaPure = $mediaPure.rand(1,9); // $media['name'] must looks like "image-423" ?
}
Solution:
Quote$mediaPure = JFile::stripExt($media['name']).'-';
$mediaExtension = '.'.JFile::getExt($media['name']);

while (file_exists(JPATH_ROOT.DS.$path_folder.$mediaPure.$mediaExtension$media['name'])) { // it checks "image.jpg", "image-4.jpg", "image-42.jpg" ...
   $media['name'] = $this->file_name = $mediaPure = $mediaPure.rand(1,9);
   $mediaPure .= rand(1,9);
   $media['name'] = $mediaPure.$mediaExtension;
}
$this->file_name = $media['name'];

Milbo

ahh I missed the dot.

But your solution is missing that there exist maybe already a file with number on it, or? quite late here, I should stopp and start tomorrow, fresh.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Razva

Hate to break the party but...what's the final fix on the current (4328) revision? :)

Later edit: seems that the problem is fixed in the latest SVN.