Exercise with PHP and JSON

Exercise with PHP and JSON
0

#1

I am puzzled and I don’t know how to proceed, anyone could give me some instructions?

HERE ARE THE INSTRUCTIONS OF THE EXERCISE:

Think about the data management of the supermarket products.

Create a page Receive.php that takes values in input using the $_POST method

A field ‘name’ (the name of the product)
A fiel ‘price’
and using $_FILES an image related to the product.

Once the data have been received in input:

  1. create a file ‘object.json

with the following structure:

NAME, PRICE, IMAGE

PS: IMAGE will hold the path associated with the image

  1. Reduce the resolution of the image to the half of its previous one and save it on the server that will host the page Receive.php

For example if the image received has as

		resolution 800x600, the resized image will be 400x300

I came up with the following solution using w3 schools and some other resources but I don’t know if it works.


#2

Is this your job application exercises? If so, I think you should really work on these yourself without any help.


#3

You’re right. I have completed the exercise now (even if it doesn’t work) but I am pretty sure it has a bunch of things that doesn’t make it work.
I am unsure even about applying but it’s just an internship (maybe I am underestimating an internship?) and it said that it didn’t require any experience, it only required my diploma .
I didn’t expect them to ask questions related to the back-end actually. :sweat_smile::sweat_smile:

I have never done anything like that at school honestly, we only used PHP with stuff related with mySQL. Also, I have been working a lot and focusing only on the front-end in the last months. So I did it all using external resources. I only knew how to get a value using post with a form. They gave me the choice to only do one of the exercises so I’ll go for this one because it passed too much time since they sent me the e-mail.

Let me know what you think, because I am probably wrong about everything.