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 ?
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?
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
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.
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}'");
}
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.