Author Topic: [FIXED] Cannot upload images + mimetype error + slug error  (Read 7793 times)

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 9856
  • VM3.2 Cached and Optimized
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: [BUG] Cannot upload images + mimetype error + slug error
« Reply #15 on: October 08, 2011, 18:06:37 pm »
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.
I should fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

constantined

  • Beginner
  • *
  • Posts: 13
Re: [BUG] Cannot upload images + mimetype error + slug error
« Reply #16 on: October 09, 2011, 15:17:36 pm »
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

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 9856
  • VM3.2 Cached and Optimized
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: [BUG] Cannot upload images + mimetype error + slug error
« Reply #17 on: October 09, 2011, 23:16:46 pm »
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.
I should fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Razva

  • Jr. Member
  • **
  • Posts: 55
Re: [BUG] Cannot upload images + mimetype error + slug error
« Reply #18 on: October 10, 2011, 10:46:40 am »
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.