Part-DB / Part-DB-legacy

[LEGACY Version] Open Source Electronic Parts Database using PHP and MySQL
GNU General Public License v2.0
158 stars 35 forks source link

Using Docker-latest: image upload doesn't work #61

Closed julianrendell closed 5 years ago

julianrendell commented 5 years ago

Thank you for creating part-db!

We are trying it for inventory management of tools and components (not just electronics) in our makerspace.

However image upload for parts appears to be broken in the "latest" docker image.

Followed the docker instructions for the "latest" option.

Created a basic category and location.

Created a part.

Edited info for part, tried to upload an image from phone, and from PC. Failed ("Name can't be empty", or nothing happens.)

Tried on Safari and Chrome.

Re-deployed using stable image, and everything is working beautifully (thanks!)

Side question: any recommendation re entering equipment (soldering irons, ovens, etc)?

OpaApo commented 5 years ago

I would also like to thank you for creating Part-DB.

We didn't use Docker but installed it the normal way. It's 0.6.0-dev from 04.05.2019. The "Browse" button works. After choosing a file, the "Remove" button appears but the field "Dateiname / URL:" stays empty. Nothing happens when pressing "Hinzufügen". Tried on Firefox and Chromium.

jlegen commented 5 years ago

had the same issue; fix for me was: in file inc/lib.php, swap this if-clause (~ line 283)

//Dont allow to upload a PHP file.
if (strpos($file_array['name'], '.php') != false
    || strpos($destination_filename, '.php') != false) {
    throw new \Exception(_('Es ist nicht erlaubt PHP Dateien hochzuladen!'));
}

with this one below:

if ($destination_filename == null) {
    $destination_filename = $file_array['name'];
}

(=> make sure $destination_filename is set before applying strpos() on it)

OpaApo commented 5 years ago

had the same issue; fix for me was: in file inc/lib.php, swap this if-clause (~ line 283)

//Dont allow to upload a PHP file.
if (strpos($file_array['name'], '.php') != false
    || strpos($destination_filename, '.php') != false) {
    throw new \Exception(_('Es ist nicht erlaubt PHP Dateien hochzuladen!'));
}

with this one below:

if ($destination_filename == null) {
    $destination_filename = $file_array['name'];
}

(=> make sure $destination_filename is set before applying strpos() on it)

We incorporated it and it works. Thank you!

jbtronics commented 5 years ago

I switched the if clauses in the file, so it should work now for everyone.