Skip to content
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

File upload to media directory still not working #38

Closed
digitalbricks opened this issue Dec 17, 2012 · 31 comments
Closed

File upload to media directory still not working #38

digitalbricks opened this issue Dec 17, 2012 · 31 comments
Assignees
Labels

Comments

@digitalbricks
Copy link

First i have to say that i did not a fresh install with the current version in repository but just replaced the old files with the new ones. So maybe the problem described below is just a problem on my side.

When uploading a file, the progress bar (green/white striped) appears and then i get a modal message with no text in it (see screenshot). After pressing OK the previously uploaded file isn't in the media directory – seems the upload failed.

Bildschirmfoto 2012-12-17 um 20 38 11

Having a look into the js console, i noticed some missing JS files:
Bildschirmfoto 2012-12-17 um 21 09 47

By the way: The buttons "Alle Sektionen zeigen" and "Alle Sektionen verstecken" not working any more – propable because of the missing JS files.
Maybee i shoud do a fresh install next time? Could anyone confirm this behavior?

@creativecat
Copy link
Contributor

Are those scripts missing also in the media?
I have to check the lib_jquery/ and the get_page_headers();

@ghost ghost assigned creativecat Dec 18, 2012
@creativecat
Copy link
Contributor

Do you have lib_jquery 1.32 installed? If not please install the current version. I guess, your problem could be caused by a broken JS...
The jsadmin.js seems to be called by MPForm.. I have to contact Frank to get info about this problem...

@digitalbricks
Copy link
Author

I will do a clean install for testing these days – to eliminate errors that are caused because of just replacing old files with the new ones.

@creativecat
Copy link
Contributor

Did you already make a clean install? I've tested different systems and can't confirm this problem.

@webbird
Copy link
Contributor

webbird commented Dec 19, 2012

Tried it with my fresh installation I made yesterday. Tested with Zips and Jpegs, also created a Jpeg with blanks in the name. Tested with 3 levels of subdirs. Cannot verify this problem. Tested with latest Firefox on Win7.

What browser is that? Maybe a Mac problem?

Edit: Maybe the modal window is caused by a directory permissions problem?

@webbird
Copy link
Contributor

webbird commented Dec 19, 2012

Yepp. Can confirm this with directory set to read-only perms. (Everyone R, Administrators F)

@creativecat
Copy link
Contributor

I can now confirm this bug. It happens when LEPTON_Helper_Upload is initialized.
Can't find a quick solution at the moment :-(
How about you webbird?

creativecat added a commit that referenced this issue Dec 19, 2012
Enable error message...
But still didn't fix the problem which seems to be on local
installations only.
@creativecat
Copy link
Contributor

Could be the same problem like mentioned here: http://www.verot.net/php_class_upload_forum.htm?php_class_upload_forum_id=1694

@webbird
Copy link
Contributor

webbird commented Dec 19, 2012

Hmmm... will do some research. As a workaround, we could use is_writable() first to check if the directory is writable. Maybe disable upload button then. (?)

@creativecat
Copy link
Contributor

I already tested "is_writable"... doesn't work.
It seems that the file doesn't exists. I get this error message:

An error occured:Local file doesn't exist

This message is thrown in Helper/Upload.php on line 714:

                    if ($this->uploaded && !file_exists($file))
                    {
                        $this->uploaded = false;
                        $this->error = 'Local file doesn\'t exist.';
                    }

@webbird
Copy link
Contributor

webbird commented Dec 19, 2012

is_writable works for me. I added it to the ajax_get_contents.php as a return value. Now the JS can de-activate the upload button.

if ( is_dir( $load_path ) )
{
$ajax['is_folder']   = true;
    $ajax['is_writable'] = is_writable($load_path);
    ...

Now I just have to find out how/where to de-activate that button... ;)

@webbird
Copy link
Contributor

webbird commented Dec 19, 2012

That part of Helper/Upload.php is for local files, not for uploaded files.

@creativecat
Copy link
Contributor

I get this error message since I try to initialize the upload class by

$files      = $admin->get_helper('LEPTON_Helper_Upload', $_FILES[$file_name]);

@webbird
Copy link
Contributor

webbird commented Dec 19, 2012

That's the syntax for local files. See the comment:

    /**
    * Constructor. Checks if the file has been uploaded
    *
    * The constructor takes $_FILES['form_field'] array as argument
    * where form_field is the form field name
    *
    * The constructor will check if the file has been uploaded in its temporary location, and
    * accordingly will set {@link uploaded} (and {@link error} is an error occurred)
    *
    * If the file has been uploaded, the constructor will populate all the variables holding the upload
    * information (none of the processing class variables are used here).
    * You can have access to information about the file (name, size, MIME type...).
    *
    *
    * Alternatively, you can set the first argument to be a local filename (string)
    * This allows processing of a local file, as if the file was uploaded
    *
    * @access private
    * @param  array  $file $_FILES['form_field']
    *    or   string $file Local filename
    */

@creativecat
Copy link
Contributor

I loop through all files, so $_FILES[$file_name] is an array and should work:

$files      = $admin->get_helper('Upload', $_FILES[$file_name]);

Did I missed something?

@webbird
Copy link
Contributor

webbird commented Dec 19, 2012

Just read the docs: Giving a FILENAME is treated as a local file. You will have to give the FIELDNAME (of the upload field) instead.

@creativecat
Copy link
Contributor

It is the __FIELD__name. I will change the name of variable from $file_name to $field_name on next update. The value is the field name of the upload form.
Sorry for confusion.

@creativecat
Copy link
Contributor

I get the error

Notice: Array to string conversion in /www/htdocs/w00f93e4/kunden/lepton2/upload/framework/class.wb.php on line 705

@webbird
Copy link
Contributor

webbird commented Dec 19, 2012

Let's go some steps back and add the is_writable() check first. Maybe this solves both problems.

@creativecat
Copy link
Contributor

Already tried it, but didn't solved the problem (I check is_writeable() in the backend/media/upload.php before I call the upload helper)...
So this definitely does not solve the problem. One problem seems to be located in the int_get_handle() (see my previous post)

@webbird
Copy link
Contributor

webbird commented Dec 19, 2012

PLEASE take the is_writable() solution I made, which is MUCH earlier. Checking is_writable() when giving a local file will never work.

creativecat added a commit that referenced this issue Dec 19, 2012
Check if is_writable() on loading contents of folders.
Be carful - currently this is only updated, when a folder is reloaded.
creativecat added a commit that referenced this issue Dec 19, 2012
Check if is_writable() on loading contents of folders.
Be carful - currently this is only updated, when a folder is reloaded.
creativecat added a commit that referenced this issue Dec 19, 2012
creativecat added a commit that referenced this issue Dec 19, 2012
@creativecat
Copy link
Contributor

There are two problems:

We will first fix the first problem, after that we will hopefully find a easy solution to this problem

@creativecat
Copy link
Contributor

This problem seems to be on local installation on Macs only. Could someone confirm this problem on a local installation on windows and linux?
Were you able to install Lepton2 without any errors? If you take a look on add ons - are e.g. all languages installed correct?

@webbird
Copy link
Contributor

webbird commented Dec 20, 2012

I'm not sure if I understand you right. The installer on Mac creates a read-only media folder?

As said above, I can't confirm this for Win7/XAMPP. I had to tweak the NTFS permissions manually to get this error. Don't have a Linux environment at hand.

@creativecat
Copy link
Contributor

It seems to be not a problem with permissions... I changed them to 0777.
I can't figure out, where the problem exactly occurs, but when creating the upload class I'm getting a blank page - without any error message (Error level is set to E_ALL&E_STRICT).

In my environment it also occurs when installing a fresh system. But thats another problem, that couldn't be figured out yet;-)

@webbird
Copy link
Contributor

webbird commented Dec 20, 2012

Try XDebug.

@webbird
Copy link
Contributor

webbird commented Feb 21, 2013

I have the problem now on blackcat-cms.org. As a workaround, I use the filemanager in CKE to upload files at the moment. So it's may not only a Mac problem.

webbird pushed a commit that referenced this issue Mar 25, 2013
@webbird
Copy link
Contributor

webbird commented Mar 25, 2013

Hope I fixed this. Please check the next tagged release. (Should be 0.2.0)

@creativecat
Copy link
Contributor

I found another small bug in this section: The folder url is not correct, when uploading a file. I will take a look on this small issue next week.

@webbird
Copy link
Contributor

webbird commented May 21, 2013

This just happens at first try. Reason is that the hidden form field is updated AFTER the form is sent, so the file path is not correct. At next try, the right path is sent.

webbird pushed a commit that referenced this issue May 21, 2013
@webbird
Copy link
Contributor

webbird commented May 21, 2013

I hope this is fixed, I am closing this issue now as the initial error is fixed, please open a new issue if new bugs occur. ;)

@webbird webbird closed this as completed May 21, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants