Hello friends, I need your help
I am trying to upload documents from sugar to my server
I created my custom code in detail view of my module (the form in html that calls the upload.php file), because I want to upload my documents from detail view of the module.
So I created the upload.php in order to upload the document...
My problem is in $uploaddir , because if I write the path manually, then the document upload to my server correctly, for example:PHP Code:<?php
$numaviso = $_POST["num_aviso"];
$aux = $numaviso;
//recorro la cadena aux
for($i=strlen($aux);$i>0;$i--){
if($aux{$i} != '_'){
$aux{$i} = "";
}else{
$aux{$i} = "";
if($aux{$i-1} == '.'){
$aux{$i-1} = "";
}
$i=0;
}
}
[B] $uploaddir = "/xampp/htdocs/sugarcrm/docs/DOCUM_CLIENTES/{$aux}/"; [/B]
$uploadfile = $uploaddir . basename($_FILES['archivo']['name']);
$error = $_FILES['archivo']['error'];
$subido = false;
if(isset($_POST['boton']) && $error==UPLOAD_ERR_OK){
$subido = copy($_FILES['archivo']['tmp_name'], $uploadfile);
}
if($subido) {
echo "El archivo se ha subido";
} else {
echo "Se ha producido un error: ".$error;
}
?>
$uploaddir = "/xampp/htdocs/sugarcrm/docs/DOCUM_CLIENTES/mydir/"
but I need to upload the document to differents paths on depending of my needs, so I must write the $uploaddir with variables, but then when I try to upload a document appears this message:
[function.copy]: failed to open stream: Permission denied in C:\xampp\htdocs\sugarcrm\modules\Biomasas\metadata \subir.php on line 22
Se ha producido un error: 0
Someone can help me?
Thanks
Daniel
It is not a problem of permits, because I have checked it already.


LinkBack URL
About LinkBacks




Reply With Quote
thanks so much for your answer


Bookmarks