Pregunta

I'd like to hear hear your opinions on this problem.

On my site, users must be able to upload ten images maximum, which is no problem. But they must be able manage these images, like delete two of them and upload only 2 new...

What would be the way to go? jQuery for the upload system, mySql for storing links, and then php for managing the images/links?...

I can't find the answer on StackOverflow, nor on the web...

Thanks for helping me out! Yarmo

¿Fue útil?

Solución

The easiest way is to create a separate folder for each user and count the files in it to retrieve the number of images, then easily calculate the amount of available free slots. A nice function you can use to get a directory's contents is this

function GetDirFiles($directory){
$results = array();
$handler = opendir($directory);
while ($file = readdir($handler)) {
  if ($file != "." && $file != "..") {
    $results[] = $file;
  }
}
closedir($handler);
return $results;
}
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top