In my form i have a photo field stored as blob in db, after i choose the img file nothing will happen… what could be the problem? In my apache log i see this
File does not exist: /www/yyy/_lib/tmp/sc_cb814407_ava-10-100x100.jpg
In my form i have a photo field stored as blob in db, after i choose the img file nothing will happen… what could be the problem? In my apache log i see this
File does not exist: /www/yyy/_lib/tmp/sc_cb814407_ava-10-100x100.jpg
Any help on this please? This img issue is the only thing keeping me on from finishing my form.
Are you trying to upload?? This does not look like a standard download location…
Yes, selecting the img file for upload in my form does nothing, that apache error log is from jquery trying to show me a thumbnail after choosing the file.
I assume the rights to that tmp dir are ok and that it does exist (check please).
Can you monitor the dir when you uplaod a file?? The name that appears suggests that it at least did something…
Yes, web user has full acces to tmp dir, anyway it;s 777 to everyone.
I already did that, dir lastchanged date remains the same so there is no data writen to it, maybe the problem is from php uploader class since jquery triggers ajax php that isn’t touching in anyway that tmp dir… i will take a look at it.
Ok so i’m out of ideas, with a simple form i can easily upload any image to the server but with scriptcase i can not, paths are valid, directories are accesible by everyone so what could be the problem?
Did you use advanced deploy? There you have to set the paths for the deployment. Since you are working with images/files it is important to set those. I did that wrong myself.
If you just use a typical deployment then the paths are not filled. In that case defaults are used. You can simply add some basic php in your generated code to see where it fails or do the cowards way (as I dao) install on a local machine. Then install xdebug in your php and ‘simply’ (it takes time…) debug through the code…
Now I never used upload as blob only as file so this is just my best guess.
Apart from that you should be aware of it being a real BLOB not one that gets converted (CLOB for example) to another characterset.
This issue is in both development and production environment, i have debuged some code upload.class.php and here is some data from ‘post()’ method
$this->options var
Array
(
[script_url] => http://scriptcase/scriptcase/app/claudiu/edit/ ;ok
[upload_dir] => /www/scriptcase/tmp/ ;ok&writable
[upload_url] => http://scriptcase/scriptcase/tmp/ ;ok&writable
[param_name] => photo
[max_file_size] =>
[min_file_size] => 1
[accept_file_types] => /.+$/i
[max_number_of_files] =>
[discard_aborted_uploads] => 1
[orient_image] =>
[image_versions] => Array
(
)
[upload_file_height] => 0
[upload_file_width] => 0
[upload_file_aspect] => S
[upload_file_type] => I
)
$upload var
Array
(
[name] => Array
(
[0] => ava-10-100x100.jpg ;ok
)
[type] => Array
(
[0] =>
)
[tmp_name] => Array
(
[0] =>
)
[error] => Array
(
[0] => 1
)
[size] => Array
(
[0] => 0
)
)
I have only done file uploads, not blob uploads. So this is all guesswork now. But since you can debug in php you should be able to find a piece of code that kinda looks like this:
$dir_doc = $this->Ini->path_doc . "" . "/";
if (nm_mkdir($dir_doc))
{
$arq_filename_ = fopen($this->SC_DOC_filename_, "r") ;
$reg_filename_ = fread($arq_filename_, filesize($this->SC_DOC_filename_)) ;
fclose($arq_filename_) ;
$arq_filename_ = fopen($dir_doc . trim($this->filename__scfile_name), "w") ;
fwrite($arq_filename_, $reg_filename_) ;
fclose($arq_filename_) ;
}
$this->sc_evento = "insert";
$this->NM_gera_log_key("incluir");
$this->NM_gera_log_new();
It is in your projectname_apl.php code… For me at about line 3654. Try setting a breakpoint on the fopen or better yet a few lines before…
No i don’t have anything similar since i’m using blob storage… maybe a dev could have a look at that info
You didnt say which database you used… I assume in your case you use sqlite… If so then there is another thread concerning this as well…
You may find thus url iteresting otherwise: http://stackoverflow.com/questions/7052655/insert-blobs-in-mysql-databases-with-php
I’m using oracle but the problem is before it reaches to db insertion since the img is not loaded/uploaded
I guess all that is left to test is just making a stupid simple php program that writes a file to the given dir and see if it fails. If so then display the error…
$rs=fopen(’/www/yyy/_lib/tmp/test.txt’,‘w+’);
fputs($rs,‘some test string’);
fclose($rs);
that then probably fails too… So you can have a failure in the (sub)path somewhere… Or no rights in a subpath somewhere…
More I wouldnt know…
I already did that with a simple html+php upload form and the file is moved and uploaded to the desired dir… a dev can take a look at this please?
I hope you did try to set the tmp directory somewhere else on dir you know 100% sure you can access. Setting the tmp dir should be done using the advanced deployment. I have been digging in the file uploader code a LOT since it contains a few bugs here and there. But the bug you are talking about I have never noticed. I know some files with ‘strange’ characters (>=chr(128) and + and & and so on) kinda get screwed due to these bugs (see my long piece on bugs in uploader…). But apart from that it does work… The upload as file is basically the same as upload as blob. It gets uploaded to the same tmp dir as far as I can see.
So my advice is to grab xdebug and enable debugging with xdebug and simply start doing php debugging (like I did). Likely you find the exact line where it fails in which case finding a solution would be easier…
Ok so problem solved thanks to my country scriptcase contact guy, after debugged the app/form we looked in php.ini configuration and found that upload_max_filesize had a wrong setting… Such a release