Thank you very much, Chair, and I wish first of all to thank this very generous invitation to join and to participate in this webinar, and I also welcome the very qualified audience that is attending this webinar. I would say that the spirit and the purpose of the Portuguese presidency is contained in its motto. Its motto says, time to deliver a fair green digital recovery. We were a bit inspired by the speech of the President of the Commission to the European Parliament last September. When she told us, well, we made strategic decisions in this year, 2020, mainly the revolutionary decision to launch a recovery fund in order that all the member states had the appropriate amount of financial resources to finance the recovery of their economies, and so the preservation of the internal markets. And now, next year, it will be time to deliver, to concretize, to materialize the decisions that were taken. When we say in Portuguese that it's time to action, we say that it's time to concretize the decisions that we collectively have taken. So, it's time to deliver. The first crucial verb of the Portuguese president is the verb to implement. We need to implement, as far as soon as we can, the new multi-annual financial framework. This means the new programs that will finance research and innovation in Europe, European connectivity, the academic mobility with the Erasmus program, the new program for health, and so on. So, we need to implement, first of all, the new multi-annual financial framework. We need to implement the recovery fund. We need to implement what we call the instruments for recovery and resilience, and we need to concretize this approval through the approval of each national plan for investment and reforms that each member state will first negotiate with the European Commission and then submit to approval to the council. We need to implement the far-reaching, the most important response to the pandemic that we can have. I'm speaking of vaccination. You know, and we have to keep in mind this very important fundamental decision of the European Union that was to conceive the vaccine as a basic good, a public good, a universal good. The universal accessibility of the vaccine, the full vaccination of our population, and the strong cooperation with third countries in order to guarantee that population around the world can access to this basic good was the very fundamental decision option of the European Union. And as you perhaps remember, unfortunately, it was not accompanied by countries like the United States or Russia. But for us, it's a basic commitment. So to implement the vaccination strategy, to implement the vaccination process, and of course, we need the other verb is the verb to reform. We need to implement, of course, to deliver, to obtain certain outcomes and results. But in a certain way, in a certain direction, with a certain strategy, following the strategic agenda, the leaders, the European leaders have approved in 2019, the so-called strategic agenda 2019-2024. And what tells us this agenda is that the recovery of the economy has to be at the same time the transformation of our economy. Griming it, if I may use the word, and digitalizing it. So the double transition, the digital transition and the green transition are at the core of the recovery of our economy, the transformation of our economy. This is a fundamental assumption of the new recovery fund. We are getting this amount of money, 1.8 trillion euros for member states for the next year, not to invest for investing, not to spend for spending, but with a certain purpose, to transform our economy, to transform our public administration in order to modernize it, in order to fulfill all the goals and the obligations that we currently assume under the Paris Agreement, the climate action, protection of biodiversity, and also the implementation of the artificial intelligence and the profiting from the data science with respect for the rights of citizens. So this is the other fundamental verb of our presidency, to reform and to pass successfully, to have a success in this double transition, the digital transition and the green transition. We must emphasize the social model of Europe. And I always say this is really the added value of the Portuguese presidency, is to emphasize the underlying, to underline the need to reinforce the social dimension of Europe. Of course, this has a certain dimension of implementation. In 2017 in Gothenburg, we decided to, we issued a political declaration, so a political commitment that was called the European Pillar for Social Rights. And now it's time to implement this pillar. A communication of the commission is expected next February with an action plan to implement the European Pillar of Social Rights. And we will organize an event, what we call the Social Summit in Porto, next May with a high level conference joining the European institutions and the social partners, and then the informal European Council giving political orientation and impulse to the implementation of social rights. But this has also a programmatic dimension, because we have to keep always in mind that the European economy is a market economy, but a social market economy. The European democracy is a liberal democracy. There is no such thing as an illiberal democracy. Illiberal democracy simply does not exist. So we are liberal democracies, but we are liberal democracy with a very important social dimension. And European social model is not an obstacle for growth and employment. On the country, it is a driver for growth and employment in Europe. So this dealing with what let us call it for simplicity, the internal dimension of European construction. Now moving to the external dimension. I could summarize the purpose of the Portuguese presidency in this way. We need to reinforce the autonomy of Europe, but in an open way. How can we do that? Opening Europe to all the main regions of the world. So we had in 2020 a virtual summit, but the summit with China. We are preparing since the beginning of this year, the new European Union, African Union summit. We are trying to relaunch our dialogue with Latin America. The election of Joe Biden and doubly will represent a new momentum and a new opportunity for returning to normal in relations between Europe and America. And of course, we will seize this opportunity. We don't know yet how shall we conclude the current negotiations with the United Kingdom. But for sure, United Kingdom will continue to be a European country and the close ally to all the member states of the European Union. So we thought that again, we could add some value, bringing also India and relationship with India to the core of our external policy. That's why we are going to organize an event of all the European leaders, heads of state and government, and the prime minister model. And why that? Because it is necessary to unblock the current impasse that we can see in the economic negotiations with India. India is a very important market. The market is a very important partner and we have to unblock the current difficulties of our economic negotiation. But besides that, and more important than that is the political dialogue. We have to think this way because it's true and it's necessary to think like this. India and European Union are the largest democracies in the world. India means 1.4 billion people, almost, and Europe means 450 million people living in democratic regimes. And these two democratic blocs have to improve their political relations. So just to summarize, you can understand the priorities of the Portuguese presidency. If you remember our motto, time to deliver a fair green digital recovery, you can understand, I think, very well, the spirit of the Portuguese presidency and what is the purpose of the Portuguese presidency if you combine these two verbs to implement and to reform. And you can understand the geopolitical ambition of the Portuguese presidency if you think on this idea of having a 360 degrees approach with geopolitical balance, we need to improve the relations with the United States, we need to keep the current conversations with China, but we need to keep in mind the full mosaic. And to understand the full mosaic of international relations, you have to consider Africa, you have to consider Latin America, you have to consider India and in the Pacific. Thank you very much. Thank you very much, minister. That's a very comprehensive overview of the objectives of the Portuguese presidency. Now we can go to some question and answers, but before doing so, could I ask you one of my own? What do you see as the biggest challenge in implementing the recovery program as you undertake the six months? May I give a very short and concrete response? If you wish. I will obtain a certain state of spiritual relief, the day in which all the ratifications needed by all the member states are concluded. That's the next difficulty because I think that compared to that difficulty, the process of negotiation with the European Commission and then the approval by the Council will be relatively easy. And why do I say this? Because we all agree in the parameters, in the metrics that will provide the assessment of our national plans. We know that we have to spend at least 37% of the money in measures related to climate change. We know that we have to spend at least 20% of the money in measures related to digital transition. And we know that our plans will be assessed by the Commission, considering the country-specific recommendations that were issued in 2018 and 2019. Yes, that's something good to aim for. I have a number of questions, Minister. We have indeed a question from Shada Islam, who's the Managing Director of the New Horizons Project and EU Commentator for the Guardian newspaper. And he asks, given Portugal's long-standing interest in Africa, how will Portugal give the EU-Africa relationship new energy and meaning? Well, I do think I'm going to be a little provocative that this new energy is needed. The meaning is clarified, I think, since the Abidjan Summit in 2017. We took two important decisions in Abidjan. The first one was to consider that the relationship, what we call the partnership between Europe and Africa, was, first of all, a first priority for both countries because they are neighbors, because they are complementary. And the partnership had to have a large spectrum. Not only add to development, it's very important that it's not sufficient, not only migrations, very important, but not the whole picture of the thing, but empowerment of women, institutional building, education and training, economic trade relations and investment. And the second decision that we took was to consider that this partnership had to be a partnership between equals. It's not a question of one of us helping the other or lecturing the other or supporting the other is trying to take full profit of this complementarity I was referring to and the need to improve an interrelation based on equal rights, including the right to define the agenda. Okay, so I think there is no need to change this, but there is a need to comply with this, to abide by this. Now this is a small provocation that I'm going to do. In 2018, the former president of the commission, Jean-Claude Joucair, a truly great European leader and a very good friend of mine, delivered a very important speech to the European Parliament, presenting the new alliance between Europe and Africa for growth and employment. A very, very important agenda, a very, very important document. And whenever I spoke in the subsequent, in the following months to African colleagues, they always said to me, it was a very important document, a very important speech, a very important content. We have no disagreement, but why didn't you speak with us before? Why did you present your strategy to your parliament? Why don't we work together in a joint agenda? And I think this is the main contribution Portugal can do, because in 2007, during the Portuguese presidency, we did, we did elaborate common strategy, Europe-Africa, that is the ongoing strategy that was prepared by a team composed of African experts and European experts. So, I would say that we need energy. There is a very good result in the last days, during the last days of November, that was the conclusion of the agreement on the post-connu agreement, so the framework for cooperation with Sub-Saharan Africa. There is now the external service is preparing what will be, I think, a very important document on the improvement of the South neighborhood, so our relation with North Africa and Middle East. So, we can expect that 2021 can be a good year in our relations, but it has to follow the right methods. First, working on a common agenda, then ministers having their ministerial meeting, and finally, the leaders having the summits. But we are short of time. Why? China has already scheduled the China-Africa forum for the second semester of the next year, and I would say that it would be a shame for Europe if the European Union, African Union summits would be after the China-Africa forum. We have to be coherent in our acts with what we say in our words. Thank you. Thank you. I think, minister, you will find a willing partner in Ireland for the Africa strategy, because such a priority given by the Irish government, two relations with Africa, and I'm sure we will look forward to working with Portugal in that. Another very topical question, minister, for today, from Catarina Demoni, from Reuters news agency, and she asks, does the minister think a trade deal between Britain and the EU is still possible? If not, how will the Portuguese EU presidency deal with this issue? I think it is possible, but please ask me January 1st. But if it is not possible, of course, we have to trade according to the WTO rules, but we cannot renounce to a close relationship between Britain and UK. As you said, I'm a full professor in the Faculty of Economics, but I don't think that we can think economy outside of the political and the institutional context. That's why I would say that we need a strong relationship with Britain, and Britain needs a strong relationship with Europe, but on four complementary dimensions. The first one is the convergence, the affinity between our external policies. France, European permanent member of the Security Council, is fully aligned with the United Kingdom, the other European permanent member of the Security Council. Europe and the United Kingdom have the same views on the JCPOA treaty on the Paris agreement, on the 2030 agenda and the sustainable development goals on WTO and the reform of WTO, and this is essential to maintain this convergence. Then second dimension, cooperation. We need to cooperate and to maintain our cooperation and to improve our cooperation with the United Kingdom in defense and security, be it in NATO, be it through the complementarity between NATO and the EU. We need to cooperate with the United Kingdom in matters of interior affairs and justice affairs, and we need to cooperate and to cooperate more with the United Kingdom in the common combat to terrorism and to against radicalization, and these are really critical points. Then we need the third dimension, the economic dimension. Of course, there are some difficulties, but let's have hope, and we need to maintain a close people-to-people context. It's unimaginable. I cannot imagine, at least as a Portuguese, that after 20 or 30 years of easy flows of people between Europe and Britain, British living in Europe, Europeans living and working in Britain, we can discuss of passports, visas, difficulties, restrictive migration policies, and so on. We need to maintain, through tourism, through mobility, through work conditions, and so on, we need to maintain a strong people-to-people relation between the UK and the EU. May I again, somehow provoke it? My question is a foreign minister is this, compared with the need to converge in external policies, to cooperate in defence and security, to maintain people-to-people relationship, what is the value of a divergence on fisheries quotas? We have to put things into context, and we have to put things in their real dimension. And as a teacher, as a professor, at my university, I always taught my students that you have to compare, to contextualise, and to understand in each moment what is the major variable and what is the minor variable, and the major variable in our relationship, is external policy, is cooperation, is defence, is mobility, and of course, it is also trade. Thank you for that, Minister. We continue to hope that the sensible path you outlined will indeed prevail. If I could move on to a question from a colleague of mine, Ross Fitzpatrick, in the research about Merck, an IA researcher about Mercasur, and he says that the Portuguese presidency has committed to ensuring the EU-Mercasur agreement moves forward in 2021. And what are the minister's views on the potential environmental impact of an agreement, given concerns that such a deal could lead to a further destruction of the Amazon rainforest? Obviously the Mercasur agreement is of considerable importance to everybody in the Union, but your views on that, Minister, about the environmental impact? Of course, the environmental issue is very important, and I would argue that this was one of the living criteria in our negotiations. There are several commitments by the parties in what regards the respect for the Paris Agreement and the climate action and the commitment against deforestation processes or other processes that could put in danger biodiversity. So, I don't think that a no deal with Mercasur would be more beneficial for Amazonia, the handotropical forests in Brazil than the Mercasur Agreement. That said, I have to admit that there are doubts, legitimate doubts and objections that are put in place by MEPs, members of the European Parliament, NGOs, civil society and some governments of the European Union. So, we have to do what we always do in such circumstances, speak again to each other and try to find a way of clarifying doubts and of reinforcing, strengthening commitments. So, I think that the current assays, the current, sorry, the current work that he's been doing at the level of the European Commission and the level of the Council in order to have a declaration and the next something that can clarify the environmental obligations of the parties is a good work and it can produce results. That said, I also think that we have here at stake a credibility issue and we have here at stake a fundamental issue for foreign policy and trade policy of the European Union. Let me explain very briefly. Credibility, our credibility is at stake because we're negotiating during almost 20 years. We reached an agreement, the entity which reached an agreement on our behalf was competent, the European Commission, and we have to respect our own commitments. If we say to Mercosur, we are no longer committed to what we decided to agree upon a year ago. The next time we will negotiate with other partners, this partner can say, I don't believe you. I don't believe you because with Mercosur, you're negotiating through two decades, you finalized an agreement and you didn't respect your agreement. So, first of all, an issue of credibility. But more even more important than that, an issue that has to do with the fundamental option of choice the European Union has to have. Do we want to think that we are a kind of special one, a very special, demanding, sophisticated entity, we European Union, that for that reason cannot have agreements with other partners because those partners are not fulfilling all the human rights we demand because these partners don't obey to our own labor standards because they are not so respectful of the social rights as we are, because they are not so careful of food security as we are, because they are not democracies the way we are. Are we willing to make all our trade policy dependent upon this kind of criteria or not? Do we want to be in a position of certain isolationism in the world or we don't? Last November, 15 countries of the Eastern Asia signed an economic agreement. I'm going to say the names of these countries. Thailand, Myanmar, Singapore, Cambodia, Laos, Vietnam, Indonesia, Philippines and two other countries of the Asian, Australia, New Zealand, very close allies to Europe, Korea, Japan, very close allies to Europe and China. What are the countries that are missing here? India, the United States, European Union. We cannot leave, we cannot abandon one of the most important instruments of our influence in the world, the FTAs, the free trade agreement. We cannot abandon this instrument. But if we don't conclude the process with Merkel or Seul, the risk of abandoning is quite real. So the Portuguese presidents, of course, we don't expect to conclude this process. It's a very difficult one, but we want to move forward. We want again to favor some kind of commitment. We are speaking with our European friends, we are speaking with Latin America friends in order to find what the diplomats call a landing zone. Yes, and we hope that that will come to pass. Another question which brings us back to Europe, and specifically, of course, our EU, from Mark Dempsey, who's the EU policy advisor and executive studies at Herty School in Berlin. And he asks, how does Portugal plan to tackle continuing challenges to judicial independence and civil liberties in Poland and Hungary, given the recently agreed rule of law mechanism which may take at least 18 months to implement? The way we decided, the way the European leaders decided, what have we decided? Well, back to 2007, we decided to include an article seven, well, we decided to include an article two in our treaty, setting explicitly what are our common values that are, of course, synonymous conditions to belonging to the European Union. And we decided to include an article seven explaining the procedures and consequences that we could, we should take if any of us would put in parole, in venture, the values presented in article second. So there is currently two processes under article seven in the council, one against Hungary launched by the European Parliament, the other against Poland, and we will pursue these two processes. Then we, with a very important contribution of the Croatian presidency, and down, and then because of the important action taken by the German presidency, we have now a new mechanism, a peer review assessment of our state of art concerning the human rights, the rule of law and the independence of the judiciary in all member states. The first report was issued by European Commission last September or October, and then we did already, we already did, in depth assessment of five member states that were chosen by alphabetical order, that was the only criteria. Portugal, the Portuguese presidency, we will go on with this process, organizing the in-depth assessment of the next, of the following group of five member states, countries like Germany, like France, like Spain, like Greece, like Denmark, I think, but I'm speaking by heart, are now in this second group, and we believe in this peer review mechanism. I am professionally a scientist, many people attending to the webinar and work in think tanks, research centers, universities, and you know how important is this peer review, how pressing, how the enormous capacity of the standard setting throughout these processes. And third complementary mechanism is this conditionality mechanism that we, the leaders decided last July. So the allocation of European funds will be in the next multi-annual framework, will be also dependent upon our compliance with the rule of law. And this is a good step forward. As you know, Poland and Hungary contested it. The Portuguese way was in this case the European way, we listened to their arguments, and we said, well, there is a valid argument in this point, the need for legal certainty. But in our institutional architecture, the body that can decide if the thing is legal or illegal is the court. So let's, and the compromise was we will not apply, the commission will not apply the new mechanism before the European Court of Justice can pronounce its legality. We think it's legal, so we are comfortable with this procedure. Thank you. Thank you, minister. And I just, I have another question. Portugal will advance a deeper integration in the EU. How, how will you go ahead with this? Will this be a deeper economic integration, political integration? I know you feel that this is necessary because of events where we have been pulling away from the US in the last few years and the difficulties with China, with Russia. So we have, I think, developed a more greater sense of the need to stand alone. How will you bring this forward? Well, may I use a football metaphor? It's, it's, it's permissible. Yes. Okay. Because for many times, our national team played very well in a, in a rather Brazilian way with a certain beauty, but it was not effective. Now we are more effective, we are more pragmatism. So it's perhaps surprising for the audience this pragmatism that is the, the threat of my intervention in this webinar. But I think that in order to deliver, in order to act, we have to be pragmatic. So the Portuguese position is, is this one. Let's not open new dossiers before completing the dossiers that we have. We took decisions. We took decisions in Maastricht. We took decisions in Nice. We took decisions in Lisbon that are not yet implemented. One, and one, and perhaps the most urgent one, most important one, was the decision to create economic and monetary union. The economic and monetary union, euro area is not completed. The banking union is not completed because there is not yet European insured mechanism for banking deposits. So the resolution is now the banking resolution is under the responsibility of a European body in the European Central Bank, but the financial responsibilities associated with the resolution are still under the national budgets and the national taxpayers. So we have to conclude this. We decided to advance in a common monetary policy. But the, you know, the automatic stabilizers are still in the hands of a national member state. We don't have a reassured mechanism at the European level for unemployment subsidies. So the, the, the rules for budget, budget policy are already European, but the costs for budgetary policy are still national. And I couldn't move forward. The, the union of the financial markets is not yet concluded. And we are discussing for years and years if we need European monetary funds, a European treasury, if we need a common budget with real expression. And it was exceptionally because of the pandemic that we decided the first common debt issuance with some expression. So euro area, the conditions, the, the, the dimensions of the European economic, the economic and monetary, monetary union are still at stake. Let's, let's move on, on this. So I would, I would say that this is not the time for another federalist movement or for a pushback. I would not recommend to open again very, always very complex and uncertain discussion on treaties on the institution architecture. I would recommend to, to, to organize the, the, the European policy, the European public policies, policies, and to complete the dossiers that we opened 20 years ago, 10 years ago, or five years ago. And for me, this is really the sense. This is really the raison d'etre of the conference on the future of Europe. The conference on the future of Europe has to be a sort of common house, sort of a living room, but a Portuguese living room in which the people speak, speak, and say things to not, not a living room in which we are silencing television. No, a living room when we speak in a very Italian or Portuguese way, loudly if necessary. But the conference has to be a living room in which European institutions, member states, the social partners, the NGOs and citizens chosen in a random way can discuss the future of Europe, not matters of the faculty of law, not details of the Brussels machinery, but the needs of the citizens, the voice of the citizens, and the public policies that can respond to them. There is a, if I may, quote an extraordinary American economist, a British American economist, Albert Yishman, you know that he said that all the forms of action could be summarized in this triple dimension, to exit, to be loyal, or to voice. And he explained very well that in authoritarian regimes, in traditional regimes, we are asked to be loyal period. In authoritarian regimes, or in pure markets, you can exit, in markets you can exit, but in democracies, you have the right to the voice. So let's apply this right to complete the avenues we opened and not to open other avenues without completing the formal ones. Yes. That's a poetic way. That's a very wise, and as you say, poetic way. We are running out of time, Minister, and I promised faithfully to let you go at two o'clock. I just want to mention that our Ralf Victory, our ambassador in Portugal, reminds us that Ireland is taking over a term on the Security Council on the 1st of January, and that we do hope that we can, of course, cooperate closely with the Portuguese presidency, and that there will be greater EU-UN cooperation over the coming months, which I think is a hope we all would. We could hold you on, Minister, for another hour because we have many more questions, and I'm sorry we have not come to them, but we want to wish you every possible success in the forthcoming six months. You have a huge agenda, but we place every confidence in the presidency that you will implement your action agenda and for all that has to be done following on decisions, and now it's action time. So our very best wishes and our thanks to you, and in the meantime, we wish you a happy Christmas and a happy Christmas also to all our participants. Thank you for the very rich discussion, Minister, a lot of to think about. Thank you very much. If I can say some final words, let me invoke my admiration for the British history, the British people, and also for the British literature, and say that perhaps we can take on the back of our mind during the first semester two great novels by Charles Dickens in hard times, great expectations. Merry Christmas.


Hey everybody, this is Brian. Welcome to the 25th LAMP tutorial. Today we're going to be discussing how to upload a file and some of the problems that can arise. Alright, now I have to say working with file uploads in PHP is actually much simpler than in some languages. In some languages it's just a nightmare. But PHP makes it pretty simple. Here are some things you need to be aware of. When you upload from a form, your ink type must be multi-part form data. And what happens is, when you submit this form, it will create a global variable called dollar sign underscore files, or files. Notice how this is a multi-dimensional array. You can upload multiple files at a time, but for this specific tutorial we're going to upload just one file just to learn the principles of this. Notice the name here for the first element, file. Well, it gets this name from your input. See, name file. So just know that if you change this name, you're going to have to change it here to match your other code. I should say PHP will automatically do it. Now, what happens is when you submit your data, I should say you submit the form, the data is uploaded. The web server automatically hands it off to PHP that realizes, hey, they're uploading a file. So rather than forcing you to play around with the get, post, and request variables, it makes a new one called files. And populates it with this information, the file name, the type, this is a mime type, the size, the temp name, and the error. Now, the error is a number that correlates to the error code. If it's zero, that means everything worked fine. If it's something other than zero, it means something bad happened. Temp name, what's a temp name? Well, what happens in the background is that the file is actually uploaded to the server into a temp location based off the PHP config. From there, the file just sits there, ready for you to do whatever you want to do to it. So let's actually make this example work. Let's go out here. And of course, we're going to change this around. So we're just going to post into ourselves here, and we're going to grab that other code super quick. And don't worry, we're going to go over this line by line. I just want to get it nice and pretty in my little IDE here. All right, so what we're going to do here, as you can see, is we're posting into our current page, Tut 25 PHP. The ink type is multi-part form data. Once we hit the submit button, the data will be posted to the web server. PHP will detect, hey, they're uploading a file. It's going to make this global variable called files. So the first thing you need to do is check to see if the error field is greater than zero, because if it is, it means there was an error. That's why we're spitting out, hey, error, something happened. If it's less than zero or equal to zero, that means no error occurred. Then we're just going to display the statistics of the file here. Now let's do this. Now you see how it says icon two, it's because this is previously cached, but we're just going to grab a separate file here. Say icon one, submit, and voila, there's the information for icon one. There's our file name, there's our mime type. If you don't know what a mime type is, you have to think about things from a file level. Files are just blobs of data. The operating system has no idea the difference between a spreadsheet or a picture or a video or an mp3. It tries to determine that based off, well, the file extension. The problem is file extensions can be changed and they're misleading, so they include what's called a mime type. Different operating systems handle mime types differently, but essentially it tells you how to handle that file. We can see it's an image, a JPG, so we tell it, hey, this is an image. Use image programs, not spreadsheets. Here's the size in kilobytes, and here is the temp location. Now, that is the actual file itself that has been uploaded to the server, ready for us to manipulate and do as we wish. How do we go about displaying that on our web page? Well, that's a very good question. The first thing we need to do is put it somewhere where we can actually access it, so let's move the file. We're going to make a few variables here. We're just going to simplify this a little bit just so we can see what's going on here.  You already have access to those. Why are you recreating them? Well, just for simplicity's sake and for illustrative purposes. So we have our directory. We want to move it to our var www. We have our file name, and then we have the temp name where it's actually been uploaded to. Now, remember, the name is actually the name of the file, not the full path. Now, PHP has a function called move uploaded file, which, as you might have guessed, moves the uploaded file. It knows where that temporary path is and knows how to find it. All right. So what we need is a source file and a destination file. Well, our source file in this case is the temp file. And the destination file is going to be dir, and you guessed it, file name. It's worth noting that if you put it in a folder other than www, like if you make an images folder or something like that, that you're going to have to have the permission set up correctly to do that. Sometimes they propagate automatically, other times they don't, but it's beyond the scope of this tutorial. Right now we're just handling how to upload the file. Now we want to display that file. So we're just going to say echo, and we're going to repost that data. Oops, probably help if I didn't have an error message there. Oh, yes. That's what I get for being in a hurry. There's our file in all of its glory. So once again, let's kind of look at this real quick and see what's going on with this code. We have our form. The user can click here, and let's grab a different image. Once they submit this, it's posting back into itself using the ink type of multi-part form data. Notice how the input, the name, has to line up with what we're looking for here. So use file or uploaded file, however you do that. Always check the error. Just make sure the error number is zero. If it's greater than zero, then something happened, and you should let the user know. And then we're just grabbing some statistics. You don't really need to show those to the end user. And then, ta-da, displaying the file. We're moving the file using the move uploaded file, and that's very important. If you don't move the file, it's going to be in the temp directory, which your web server does not have access to. So let's go out to our file system here. Let's go far. Yeah, see, there's the file we just uploaded. Submit this. Notice that, ta-da, there's our new file. If we go out here, ta-da, there's our new file. Very simple, very easy to work with. There are many, many, many, many ways of doing this in PHP, so many that I don't think I could do enough tutorials on them. For example, on W3Schools, or as one of the viewers, I'm sorry, I forgot your name. I'm horrible with names, especially right on the spot. I don't remember, but it's not coming, I'm sorry. Here's a good example. He calls us W3Fools, not W3Schools. I thought that was pretty funny. But they do show a pretty good example of how to filter for extensions. For example, if, you know, files, file type, equals, et cetera, et cetera, then, blah, blah, blah. Important note that the, for IE to recognize JPEG files, they must be PJPEG, Firefox will be JPEG. And I think the reason why he calls them W3Fools is because their information is not 100% accurate, 100% of the time. I've worked with IE in the past, and I do know they do take MIME types of JPEG. So that's how that works. Let's see. Saving the uploaded file. They pretty much just talk about what we just did. Move uploaded file. They do a little more complex stuff. For example, they check to see if the file exists, which is always a good idea. If the file already exists, you know, displaying error message, otherwise move it. That's all for this tutorial. Pretty complex topic, but PHP makes it very simple. Trying to think if there was something else. Oh, yes, directory permissions. If you are in a real-world situation and you're trying to upload a file and you keep getting error messages, and let's say, you know, you have like a new folder. We'll just call it images. We'll go out and look at the properties of that. Because chances are, you might not have permission to actually move the file. See, access? You need create and delete. Things of that nature. It all depends on how your web server is set up and under what username your web server is running and PHP is running. So that's all for now. Thank you for watching. I hope you found this educational and entertaining.