We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

File

Development and Programming

evasion's avatar
evasion
58 posts
16 years ago
evasion's avatar evasion

slapshotw your solution needs that each uploaded file has a label. In fact I want to do something like that :

IMAGE 1 - label 1 IMAGE 2 - no label IMAGE 3 - label 3

With your solution I think it would do something like that :

IMAGE 1 - label 1 IMAGE 2 - label 3 IMAGE 3 - error/no label

Am I right ? Is there any other way to do that ? Does someone would be interested in coding something like that ?

       
Matt Weinberg's avatar
Matt Weinberg
489 posts
16 years ago
Matt Weinberg's avatar Matt Weinberg

Can’t you just skip a line to have an image have no label? I haven’t tested it but it may work.

       
stinhambo's avatar
stinhambo
1,268 posts
16 years ago
stinhambo's avatar stinhambo

I’m not sure if it’s been covered before but I am having a lot of difficulty in transferring file uploaded photos etc from local to live servers.

I am having permission problems (File sets files to CHMOD 000).

       
Matt Weinberg's avatar
Matt Weinberg
489 posts
16 years ago
Matt Weinberg's avatar Matt Weinberg

File is setting them to 000? How are they readable? File just runs as PHP, so should be setting them to whatever PHP is set to store files as by default (as far as I know). On my machine it’s 755.

       
stinhambo's avatar
stinhambo
1,268 posts
16 years ago
stinhambo's avatar stinhambo

Beats me Slapshow!

I used Transmit and Coda to check they both report the same thing. I can view them on MAMP no problem but they won’t let me change permissions or upload to a live server.

       
Matt Weinberg's avatar
Matt Weinberg
489 posts
16 years ago
Matt Weinberg's avatar Matt Weinberg

Have you tried sudo chmod to get them back to 755 or 777 then doing the move? With the sudo you shouldn’t have an issue changing the permissions.

       
stinhambo's avatar
stinhambo
1,268 posts
16 years ago
stinhambo's avatar stinhambo

haha I’m not familiar with the command line. How would one go about sudoing?

       
Ingmar Greil's avatar
Ingmar Greil
29,243 posts
16 years ago
Ingmar Greil's avatar Ingmar Greil

Just like that, “sudo” (as in “SUperuser DO”) on the commandline, directly followed by the command you want to run as root.

       
matt romaine's avatar
matt romaine
50 posts
16 years ago
matt romaine's avatar matt romaine

indeed, it seems the original file is set at permission 600, while a thumbnail is created as 622.

stinhambo - not sure if you fixed your problem, but to use sudo simply type:

sudo chmod 644 <filename>

in the same directory as the file itself. you should read-up on unix commands sudo and chmod when you get a chance.

With that out of the way - can anyone verify if they are having similar “strict” file permission issues on the originally uploaded file?

       
Matt Weinberg's avatar
Matt Weinberg
489 posts
16 years ago
Matt Weinberg's avatar Matt Weinberg

I’m not— I’m seeing 755 or 777 on both the original upload and the thumb. I think it heavily depends on how PHP and Apache are setup, including if you’re running PHPSuExec.

       
F. Albrecht's avatar
F. Albrecht
75 posts
16 years ago
F. Albrecht's avatar F. Albrecht

I’ve got the same problem with the permission of the original file. Thumbs were ok, original pictures were set to 6xx and not readable for a browser client.

I’ve solved the problem via a chmod “hack”. Look in ext_mh_file.php ( v3.1.1) for lines 864 - 87x:

//  =============================================
//  Do the Upload
//  =============================================
foreach($file_tmp_names as $file_key=>$file_tmp_name)
{
    if(@move_uploaded_file($file_tmp_name, $server_path.$file_names[$file_key]) === FALSE)
    {
        $errors[] = str_replace(array('%{field}', '%{file}'), array($file_field['field_label'], $file_names[$file_key]), $LANG->line('error_transfer'));
    }
    @chmod($server_path.$file_names[$file_key], 0777); // added by author of this post
}

The last line with the chmod function was added by me and the extension is working right now.

2nd

       
Brandon C.'s avatar
Brandon C.
43 posts
16 years ago
Brandon C.'s avatar Brandon C.

slapshotw - sorry I missed your reply to my last post. Do you know if there’s somewhere I can get more information about using a PHP variable for {count}?

       
Matt Weinberg's avatar
Matt Weinberg
489 posts
16 years ago
Matt Weinberg's avatar Matt Weinberg

Are you familiar with PHP? Make sure PHP is set to output. Set the variable to 0 before you start the tag loop, then increment it ($var++;) at the very beginning of the loop (right after the opening tag). Then you can do if/thens in PHP, and use PHP to echo the correct output.

       
Brandon C.'s avatar
Brandon C.
43 posts
16 years ago
Brandon C.'s avatar Brandon C.

I’m just getting up to speed on PHP, but this is outside of what I know. I’ve got a small budget set aside for things like this if you or someone you know would be willing to code this for me.

       
DMT Media's avatar
DMT Media
12 posts
16 years ago
DMT Media's avatar DMT Media

Trouble with File 3.1.1 and SQL 4.x.x?

Hi all, I’m not the best with PHP or SQL but here’s my problem, and the solution I created.

I was having trouble with the newest iteration of this extension when using mySQL 4.1.13. After taking a look at the file I determined the cause of the issue. The SQL statement that updates the prefs table in the database is a newer piece of code that combines both the insert and update statements into one, allowing mySQL to check for a pre-existing table in the database instead of PHP. I don’t know of a way to combine these two queries into one, the way the Mark did, but its not like these queries will be called much anyway. The code change is below:

Replace the code on line 491:

$DB->query("INSERT INTO exp_mh_file VALUES('', {$id}, '{$key}', '{$value}') ON DUPLICATE KEY UPDATE id=values(id), `key`=values(`key`), value=values(value)");

–With the following–

$pref_results = $DB->query("SELECT * FROM exp_mh_file WHERE exp_mh_file.upload_id='{$id}' AND exp_mh_file.key='{$key}'");
if (!$pref_results) {
$DB->query("INSERT INTO exp_mh_file VALUES('', {$id}, '{$key}', '{$value}')");
}else{
$DB->query("UPDATE exp_mh_file SET exp_mh_file.value='{$value}' WHERE exp_mh_file.upload_id='{$id}' AND exp_mh_file.key='{$key}'");
}
       
First 37 38 39 40 41 Last

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.