Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
2
2018_web_app
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
inutralia
2018_web_app
Commits
81a3248a
Commit
81a3248a
authored
Dec 04, 2018
by
David Villalba
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cambiar el upload file a trait
parent
a327f521
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
88 deletions
+0
-88
uploadfile.php
fuel/app/classes/controller/uploadfile.php
+0
-88
No files found.
fuel/app/classes/controller/uploadfile.php
deleted
100644 → 0
View file @
a327f521
<?php
/**
* Created by PhpStorm.
* User: admin
* Date: 23/07/2015
* Time: 14:03
*/
class
Controller_Uploadfile
{
/**
* @desc: Sube a carpeta temporal correspondiente el archivo para que quede pendiente de subir
* @param $id
* @param $path
* @return string
*/
public
function
upload_pagos_file
(
$id
,
$path
)
{
// Configuracion del fichero
$config
=
array
(
'path'
=>
DOCROOT
.
"files/
$path
/"
.
$id
,
'randomize'
=>
false
,
);
$config
[
'path'
]
=
str_replace
(
'\\'
,
'/'
,
$config
[
'path'
]);
// Procesa el archivo subido
Upload
::
process
(
$config
);
Log
::
error
(
"PATH UPLOAD"
.
$config
[
'path'
]);
// si no hay ficheros erroneos, guarda el fichero de acuerdo con la configuracion
if
(
Upload
::
is_valid
())
{
Upload
::
save
();
$file
=
Upload
::
get_files
();
// ubicación del fichero con el nombre asignado.
$uploaded_file
=
$file
[
0
][
'saved_to'
]
.
$file
[
0
][
'saved_as'
];
}
else
$uploaded_file
=
'error'
;
return
$uploaded_file
;
}
/**@desc: Guarda en el modelo de datos la direccion y el ID del archivo
* @param $path
* @return mixed
* @throws Exception
*/
public
function
saveFile
(
$path
,
$id
)
{
if
(
$path
==
"compraventa"
){
$file
=
Model_CompraventaDocumento
::
forge
();
}
else
{
$file
=
Model_ContratoDocumento
::
forge
();
}
$filePath
=
$this
->
upload_pagos_file
(
$id
,
$path
);
$filePath
=
str_replace
(
'\\'
,
'/'
,
$filePath
);
Log
::
error
(
"despuesd de guardar
$filePath
"
);
$filePath
=
explode
(
"/"
,
$filePath
);
if
(
sizeof
(
$filePath
)
<=
0
){
Log
::
error
(
"Ocurrio un error relacionado con el path al guardar"
);
return
false
;
}
$filePath
=
$filePath
[
sizeof
(
$filePath
)
-
1
];
Log
::
error
(
"PATH=>
$filePath
"
);
$file
->
ds
=
$filePath
;
if
(
$path
==
"compraventa"
){
$file
->
compraventa_id
=
$id
;
}
else
{
$file
->
contrato_id
=
$id
;
}
$this
->
path
=
$filePath
;
$file
->
save
();
$ret
[
'id'
]
=
$file
->
id
;
$ret
[
'path'
]
=
$file
->
ds
;
return
$ret
;
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment