Welcome Guest, Not a member yet? Register   Sign In
File upload class: add a name to the file
#1

[eluser]swissbastian[/eluser]
Hi there

I'm just trying to configure a file upload form. I just want users to be able to upload a picture. This picture is saved with the user id as file name. Does the class support adding a specific file name to store file in the configured path?
#2

[eluser]Matthew Lanham[/eluser]
Well i haven't done what your talking about before, but from looking at the upload.php file in the libraries folder there does not seem to be a way to do this, i would suggest either writing in a way to do it somewhere about line 186 - 192:

// Set the uploaded data as class variables
$this->file_temp = $_FILES[$field]['tmp_name'];
$this->file_name = $_FILES[$field]['name'];
$this->file_size = $_FILES[$field]['size'];
$this->file_type = preg_replace("/^(.+?);.*$/", "\\1", $_FILES[$field]['type']);
$this->file_type = strtolower($this->file_type);
$this->file_ext = $this->get_extension($_FILES[$field]['name']);

Specifically:

$this->file_name = $_FILES[$field]['name'];




Theme © iAndrew 2016 - Forum software by © MyBB