Failed to move uploaded file to /media directory.

13 years 2 months ago #68693 by Sheepy
I get the problem with CB 1.1 on WAMP too. And I find out what is wrong for us whom file size and permission is not the problem. B)

Turns out it is not WAMP problem. It's CB problem on Windows. :angry:




Simple solution:

1. Open administrator/components/com_comprofiler/admin.comprofiler.controller.php

2. Search for the function name "move_uploaded_file", in my version it is line 3206 in uploadFile()

3. Replace the function name with "rename", so that it now reads:

if (rename( $filename, $baseDir . $userfile_name )) {

or, to add more lines,

if (file_exists( $baseDir )) {
if (is_writable( $baseDir )) {
if (rename( $filename, $baseDir . $userfile_name )) {
if ((!is_callable("mosChmod")) or mosChmod( $baseDir . $userfile_name )) { // mambo 4.5.1 support
return true;

4. Save. Try to upload install again.




Cause of problem:

The problem is that, under windows, tmp_name of uploaded file is in backslashes. Error trace:

1. uploadFile() is called by installPluginUpload() [admin.comprofiler.controller.php:3176]

2. installPluginUpload() calls cbGetParam() to get uploaded file's location [admin.comprofiler.controller.php:3166]

3. cbGetParam() either cast parameters to int or addslashes() them [comprofiler.class.php:1740]

4. uploadFile()'s $filename becomes double-slashed on Windows. Thus it fails is_uploaded_file(). Thus move_uploaded_file() fails.

There are a number of ways this can be properly fixed. Be warned that technically my solution is not that safest one. :dry:



EDIT: Backslash also have problem in post rendering. I initially used backslashs for file path but the slashes won't show. Reaaly got some slash problems, uh? :pinch:

Post edited by: Sheepy, at: 2008/07/18 13:38

Post edited by: Sheepy, at: 2008/07/18 13:43

Please Log in to join the conversation.

13 years 1 month ago #73481 by cyberjoex
If you're still having problems installing the component. Maybe you can try this ALTERNATE way of installing the component. It worked on my VirtuaMart installation problem.

1. Unpack the contents of the package.
2. Upload the files to /media or /tmp folder using your FTP client.
3. At your Administrator-> Installers->Components page, specify the direct location of the /media or /tmp folder (depends on where you uploaded) in the “Install directory:” field. A complete path is already specified there, you’d just have to edit the last part.
4. Click Install and you’re finished.

Joe
What I find interesting, I blog it here...
www.extratopics.com

Please Log in to join the conversation.

13 years 1 week ago #76576 by dimeoscuro
cyberjoex wrote:

If you're still having problems installing the component. Maybe you can try this ALTERNATE way of installing the component. It worked on my VirtuaMart installation problem.

1. Unpack the contents of the package.
2. Upload the files to /media or /tmp folder using your FTP client.
3. At your Administrator-> Installers->Components page, specify the direct location of the /media or /tmp folder (depends on where you uploaded) in the “Install directory:” field. A complete path is already specified there, you’d just have to edit the last part.
4. Click Install and you’re finished.


Men, you are the best!!!!!!!!!! One karma lvl up for you ^^!!

This works perfect!

Post edited by: dimeoscuro, at: 2008/10/07 00:34

Please Log in to join the conversation.

13 years 1 day ago #77441 by thomas01
thanx it helped me too :)

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.136 seconds

Facebook Twitter LinkedIn