File upload

QuestionsFile upload
Roberto Ventosti asked 1 year ago

I have a problem with the file upload, once uploaded the file I do not know why but the file itself is deleted and is no longer available.

I attach the code for greater clarity.
* PHP Grid Component
* @author Abu Ghufran <[email protected]> –
* @version 2.0.0
* @license: see license.txt included in package

// include db config
// include and create object

// another detail grid.
$grid = new jqgrid($db_conf);
$opt = array();
$opt[“sortname”] = ‘id’; // by default sort grid by this field
$opt[“sortorder”] = “desc”; // ASC or DESC
$opt[“height”] = “100”;
$opt[“width”] = “50%”;
$opt[“caption”] = “Doc”; // caption of grid
“add”=>true, // allow/disallow add
“edit”=>true, // allow/disallow edit
“delete”=>true, // allow/disallow delete
“rowactions”=>true, // show/hide row wise edit/del/save option
“autofilter” => true, // show/hide autofilter for search
“search” => “advance” // show single/multi field search condition (e.g. simple or advance)

$grid->select_command = “SELECT * FROM Doc WHERE id_sopralluogo = $_GET[id_sopralluogo]”;
// this db table will be used for add,edit,delete
$grid->table = “Doc”;

$col = array();
$col[“title”] = “Id”; // caption of column
$col[“name”] = “id”;
$col[“width”] = “100”;
$cols[] = $col;

$col = array();
$col[“title”] = “Id sopralluogo”;
$col[“name”] = “id_sopralluogo”;
//$col[“dbname”] = “”; // this is required as we need to search in name field, not id
$col[“width”] = “100”;
$col[“align”] = “left”;
$col[“editable”] = true;
//$col[“edittype”] = “select”; // render as select
//$str = $g->get_dropdown_values(“select distinct client_id as k, name as v from clients”);
//$col[“editoptions”] = array(“value”=>$str);
$cols[] = $col;
$col = array();
$col[“title”] = “Note”;
$col[“name”] = “file”;
$col[“width”] = “50”;
$col[“editable”] = true;
$col[“edittype”] = “file”; // render as file
$col[“upload_dir”] = “Foto”; // upload here
$col[“show”] = array(“list”=>false,”edit”=>true,”add”=>true); // only show in add/edit dialog
$col[“editrules”] = array(“ifexist”=>”override”);
$cols[] = $col;
$col = array();
$col[“title”] = “Image”;
$col[“name”] = “logo”;
$col[“width”] = “200”;
$col[“editable”] = true;
$col[“default”] = “<a href='{file}’ target=’_blank’><img height=100 src='{file}’></a>”;
$col[“show”] = array(“list”=>true,”edit”=>false,”add”=>false); // only show in listing
$cols[] = $col;
$sopralluogo[“on_insert”] = array(“add_sopralluogo”, null, true);
function add_sopralluogo(&$data)
$id = intval($_GET[“id_sopralluogo”]);
$data[“params”][“id_sopralluogo”] = $id;
// generate grid output, with unique grid name as ‘list1’
$out_list3 = $grid->render(“list3”);
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.1//EN” “”&gt;
<link rel=”stylesheet” type=”text/css” media=”screen” href=”../phpgrid/lib/js/themes/redmond/jquery-ui.custom.css”></link>
<link rel=”stylesheet” type=”text/css” media=”screen” href=”../phpgrid/lib/js/jqgrid/css/ui.jqgrid.css”></link>

<script src=”../phpgrid/lib/js/jquery.min.js” type=”text/javascript”></script>
<script src=”../phpgrid/lib/js/jqgrid/js/i18n/grid.locale-en.js” type=”text/javascript”></script>
<script src=”../phpgrid/lib/js/jqgrid/js/jquery.jqGrid.min.js” type=”text/javascript”></script>
<script src=”../phpgrid/lib/js/themes/jquery-ui.custom.min.js” type=”text/javascript”></script>
// open dialog for editing
var opts = {
‘ondblClickRow’: function (id) {
jQuery(this).jqGrid(‘editGridRow’, id, <?php echo json_encode_jsfunc($g->options[“edit_options”])?>);

<?php echo $out_list3?>



5 Answers
Abu Ghufran Staff answered 1 year ago

Perhaps, file may not be uploaded due to permission on ‘Foto’ folder OR folder may not exist in folder where your code file exist.
You can check php error log file for exact reason. There is nothing in your code and lib code to auto-delete files.

Abu Ghufran - Dev Team
PHP Grid Framework
Ro replied 1 year ago

il file viene scritto nella cartella Foto che ha permessi 777 quando faccio la selezione per l’upload ma dando il submit il file scompare.

Speravo di avere sbagliato qualcosa ma così non so proprio che fare.

Grazie per la sollecita risposta

roberto ventosti answered 1 year ago

Sorry if I insist but I’m literally going crazy I rewrote the code but the behavior is the same, when the file is selected the file itself is written in the correct destination folder but as soon as you press submit the file disappears. I really do not know what to do I tried them all. Please help me. Thank you Roberto Ventosti

Abu Ghufran Staff answered 1 year ago

You can email me code + database dump at [email protected] and i’ll update you back.

Abu Ghufran - Dev Team
PHP Grid Framework
Tim Moore answered 8 months ago

Has this issue ever resolved? I am getting the same results even using the demo (file-upload-blob.php).

Abu Ghufran Staff answered 8 months ago

I rechecked this ticket, we were unable to regenerate this issue and was working as expected.
You can email me screencast (via etc) showing the issue. Email me at [email protected]

If you are testing locally, try after disabling anti-virus.

Abu Ghufran - Dev Team
PHP Grid Framework
Your Answer

2 + 18 =

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.

How useful was this discussion?

Click on a star to rate it!

Average rating / 5. Vote count:

We are sorry that this post was not useful for you!

Let us improve this post!